api-impl: stubs and fixes for Shosetsu

This commit is contained in:
Julian Winkler
2025-10-04 13:57:53 +02:00
committed by Mis012
parent 8dcaf3e1ef
commit e58d8d2065
18 changed files with 77 additions and 22 deletions

View File

@@ -313,3 +313,10 @@ JNIEXPORT jboolean JNICALL Java_android_app_Activity_isInMultiWindowMode(JNIEnv
{
return !gtk_window_is_maximized(window);
}
JNIEXPORT jboolean JNICALL Java_android_app_Activity_isTaskRoot(JNIEnv *env, jobject this)
{
jobject root_activity = activity_backlog ? g_list_last(activity_backlog)->data : NULL;
// NULL means that we are currently creating the root activity, so no other activity can exist yet
return root_activity == NULL || (*env)->IsSameObject(env, this, root_activity);
}

View File

@@ -13,6 +13,14 @@ extern "C" {
#define android_app_Activity_RESULT_CANCELED 0L
#undef android_app_Activity_RESULT_OK
#define android_app_Activity_RESULT_OK -1L
/*
* Class: android_app_Activity
* Method: isTaskRoot
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_android_app_Activity_isTaskRoot
(JNIEnv *, jobject);
/*
* Class: android_app_Activity
* Method: nativeFinish

View File

@@ -9,14 +9,6 @@ extern "C" {
#endif
#undef android_graphics_Region_MAX_POOL_SIZE
#define android_graphics_Region_MAX_POOL_SIZE 10L
/*
* Class: android_graphics_Region
* Method: isEmpty
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_android_graphics_Region_isEmpty
(JNIEnv *, jobject);
/*
* Class: android_graphics_Region
* Method: isRect

View File

@@ -250,6 +250,7 @@ void wrapper_widget_set_child(WrapperWidget *parent, GtkWidget *child) // TODO:
static guint queue_queue_redraw(GtkWidget *widget)
{
gtk_widget_queue_draw(widget);
g_object_unref(widget);
return G_SOURCE_REMOVE;
}
@@ -258,7 +259,7 @@ void wrapper_widget_queue_draw(WrapperWidget *wrapper)
if (wrapper->draw_method) {
/* schedule the call to gtk_widget_queue_draw for a future event loop pass in case we're currently inside the snapshot */
/* GTK+ uses G_PRIORITY_HIGH_IDLE + 10 for resizing operations, and G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. */
g_idle_add_full(G_PRIORITY_HIGH_IDLE + 20, G_SOURCE_FUNC(queue_queue_redraw), &wrapper->parent_instance, NULL);
g_idle_add_full(G_PRIORITY_HIGH_IDLE + 20, G_SOURCE_FUNC(queue_queue_redraw), g_object_ref(wrapper), NULL);
}
if(wrapper->child)

View File

@@ -74,5 +74,5 @@ JNIEXPORT void JNICALL Java_android_webkit_WebView_native_1loadDataWithBaseURL(J
jsize data_jlen = (*env)->GetStringLength(env, data_jstr);
char *data = malloc(data_len + 1); // + 1 for NUL
(*env)->GetStringUTFRegion(env, data_jstr, 0, data_jlen, data);
webkit_web_view_load_bytes(webview, g_bytes_new(data, data_len), mime_type ? _CSTRING(mime_type) : "text/html", _CSTRING(encoding), _CSTRING(base_url));
webkit_web_view_load_bytes(webview, g_bytes_new(data, data_len), mime_type ? _CSTRING(mime_type) : "text/html", encoding ? _CSTRING(encoding) : NULL, base_url ? _CSTRING(base_url) : NULL);
}

View File

@@ -568,9 +568,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback, La
public void overridePendingTransition(int enterAnim, int exitAnim) {}
public boolean isTaskRoot() {
return false;
}
public native boolean isTaskRoot();
public void postponeEnterTransition() {}

View File

@@ -0,0 +1,4 @@
package android.content;
public class AbstractThreadedSyncAdapter {
}

View File

@@ -12,6 +12,7 @@ import org.xmlpull.v1.XmlPullParser;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
public class Intent implements Parcelable {
@@ -416,4 +417,11 @@ public class Intent implements Parcelable {
public Intent getSelector() {
return selector;
}
public boolean filterEquals(Intent other) {
return Objects.equals(this.action, other.action)
&& Objects.equals(this.component, other.component)
&& Objects.equals(this.data, other.data)
&& Objects.equals(this.type, other.type);
}
}

View File

@@ -0,0 +1,4 @@
package android.content;
public class Loader {
}

View File

@@ -521,17 +521,17 @@ public class Canvas {
}
public boolean clipRect(RectF rect) {
Log.w("Canvas", "STUB: clipRect");
Log.v("Canvas", "STUB: clipRect");
return false;
}
public boolean clipRect(float left, float top, float right, float bottom, Region.Op op) {
Log.w("Canvas", "STUB: clipRect");
Log.v("Canvas", "STUB: clipRect");
return false;
}
public boolean clipRect(RectF rect, Region.Op op) {
Log.w("Canvas", "STUB: clipRect");
Log.v("Canvas", "STUB: clipRect");
return false;
}
@@ -550,4 +550,8 @@ public class Canvas {
public void drawPicture(Picture picture) {
Log.w("Canvas", "STUB: drawPicture");
}
public void drawPoint(float x, float y, Paint paint) {
Log.w("Canvas", "STUB: drawPoint");
}
}

View File

@@ -86,7 +86,8 @@ public class Region {
* Set the region to the specified rectangle
*/
public boolean set(Rect r) {
return nativeSetRect(mNativeRegion, r.left, r.top, r.right, r.bottom);
// return nativeSetRect(mNativeRegion, r.left, r.top, r.right, r.bottom);
return false;
}
/**
@@ -107,7 +108,9 @@ public class Region {
/**
* Return true if this region is empty
*/
public native boolean isEmpty();
public /*native*/ boolean isEmpty() {
return false;
}
/**
* Return true if the region contains a single rectangle
@@ -124,7 +127,7 @@ public class Region {
*/
public Rect getBounds() {
Rect r = new Rect();
nativeGetBounds(mNativeRegion, r);
// nativeGetBounds(mNativeRegion, r);
return r;
}
@@ -264,8 +267,9 @@ public class Region {
* regions. Return true if the result is not empty.
*/
public boolean op(Region region1, Region region2, Op op) {
return nativeOp(mNativeRegion, region1.mNativeRegion,
region2.mNativeRegion, op.nativeInt);
// return nativeOp(mNativeRegion, region1.mNativeRegion,
// region2.mNativeRegion, op.nativeInt);
return false;
}
public String toString() {
return nativeToString(mNativeRegion);

View File

@@ -23,7 +23,7 @@ public class NetworkInfo {
}
public int getType() {
return 0x8; // TYPE_DUMMY
return state == State.CONNECTED ? /*TYPE_WIFI*/0x1 : 0x0;
}
public boolean isConnected() {

View File

@@ -20,9 +20,17 @@ public class TextToSpeech {
return ERROR;
}
public int setOnUtteranceProgressListener(UtteranceProgressListener listener) {
return ERROR;
}
public void shutdown() {
}
public int stop() {
return ERROR;
}
public static interface OnInitListener {
abstract void onInit(int status);
}

View File

@@ -0,0 +1,4 @@
package android.speech.tts;
public class UtteranceProgressListener {
}

View File

@@ -23,4 +23,10 @@ public class CookieManager {
public void removeSessionCookies(ValueCallback callback) {}
public void flush() {}
public String getCookie(String url) {
return "";
}
public void setCookie(String url, String value) {}
}

View File

@@ -54,4 +54,6 @@ public class WebSettings {
public void setBlockNetworkLoads(boolean block) {}
public void setMixedContentMode(int mode) {}
public void setBlockNetworkImage(boolean block) {}
}

View File

@@ -96,6 +96,8 @@ public class WebView extends ViewGroup {
loadDataWithBaseURL("about:blank", data, mimeType, encoding, "about:blank");
}
public void evaluateJavascript(String script, ValueCallback resultCallback) {}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
private native void native_loadDataWithBaseURL(long widget, String baseUrl, String data, String mimeType, String encoding);

View File

@@ -75,6 +75,7 @@ srcs = [
'android/bluetooth/BluetoothManager.java',
'android/bluetooth/BluetoothProfile.java',
'android/bluetooth/le/ScanCallback.java',
'android/content/AbstractThreadedSyncAdapter.java',
'android/content/ActivityNotFoundException.java',
'android/content/AsyncQueryHandler.java',
'android/content/ATLMediaContentProvider.java',
@@ -94,6 +95,7 @@ srcs = [
'android/content/Intent.java',
'android/content/IntentFilter.java',
'android/content/IntentSender.java',
'android/content/Loader.java',
'android/content/OperationApplicationException.java',
'android/content/RestrictionsManager.java',
'android/content/SearchRecentSuggestionsProvider.java',
@@ -383,6 +385,7 @@ srcs = [
'android/security/keystore/KeyGenParameterSpec.java',
'android/service/media/MediaBrowserService.java',
'android/speech/tts/TextToSpeech.java',
'android/speech/tts/UtteranceProgressListener.java',
'android/telecom/ConnectionService.java',
'android/telecom/TelecomManager.java',
'android/telephony/CellLocation.java',