add Java APIs needed for WhatsApp MainActivity and ConversationActivity

This commit is contained in:
Julian Winkler
2024-08-25 11:20:01 +02:00
parent 9d8e091799
commit c492e1f03f
74 changed files with 903 additions and 69 deletions

View File

@@ -33,7 +33,7 @@ import java.util.Map;
public class Activity extends ContextThemeWrapper implements Window.Callback {
LayoutInflater layout_inflater;
Window window = new Window(this);
Window window = new Window(this, this);
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
public Intent intent;
private Activity resultActivity;
@@ -369,9 +369,10 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
runOnUiThread(new Runnable() {
@Override
public void run() {
nativeFinish(getWindow().native_window);
getWindow().setContentView(null);
window = null;
if (window != null) {
nativeFinish(getWindow().native_window);
window = null;
}
}
});
}
@@ -529,6 +530,14 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
public void overridePendingTransition(int enterAnim, int exitAnim) {}
public boolean isTaskRoot() {
return false;
}
public void postponeEnterTransition() {}
public void startPostponedEnterTransition() {}
private native void nativeFinish(long native_window);
public static native void nativeRecreateActivity(Activity activity);
public static native void nativeStartActivity(Activity activity);

View File

@@ -20,6 +20,10 @@ public class ActivityManager {
public long availMem = 10000;
public long totalMem = 10000;
public long threshold = 200;
public boolean lowMemory = false;
}
public void getMemoryInfo(MemoryInfo outInfo)

View File

@@ -0,0 +1,6 @@
package android.app;
public class DatePickerDialog {
public interface OnDateSetListener {}
}

View File

@@ -27,7 +27,7 @@ public class Dialog implements Window.Callback, DialogInterface {
public Dialog(Context context, int themeResId) {
this.context = context;
nativePtr = nativeInit();
window = new Window(this);
window = new Window(context, this);
window.native_window = nativePtr;
}

View File

@@ -188,6 +188,8 @@ public class Notification implements Parcelable {
public Builder addExtras(Bundle extras) {return this;}
public Builder addRemoteInput(RemoteInput remoteInput) {return this;}
public Action build() {
return action;
}
@@ -210,5 +212,19 @@ public class Notification implements Parcelable {
public BigTextStyle setBigContentTitle(CharSequence title) {return this;}
public BigTextStyle bigText(CharSequence text) {return this;}
public BigTextStyle setSummaryText(CharSequence summaryText) {return this;}
}
public static class InboxStyle extends Style {
public InboxStyle(Notification.Builder builder) {}
public InboxStyle setBigContentTitle(CharSequence title) {return this;}
public InboxStyle setSummaryText(CharSequence summaryText) {return this;}
public InboxStyle addLine(CharSequence line) {return this;}
}
}

View File

@@ -0,0 +1,23 @@
package android.app;
import android.os.Bundle;
public class RemoteInput {
public static class Builder {
public Builder(String resultKey) {}
public Builder setLabel(CharSequence label) {return this;}
public Builder setChoices(CharSequence[] choices) {return this;}
public Builder setAllowFreeFormInput(boolean allowFreeFormInput) {return this;}
public Builder addExtras(Bundle extras) {return this;}
public RemoteInput build() {
return new RemoteInput();
}
}
}

View File

@@ -40,4 +40,8 @@ public abstract class Service extends Context {
public void stopSelf() {
System.out.println("Service.stopSelf() called");
}
public void attachBaseContext(Context newBase) {
System.out.println("Service.attachBaseContext(" + newBase + ") called");
}
}