stub some APIs for Flappy Bird, mostly webview related

This commit is contained in:
Julian Winkler
2023-06-18 11:03:43 +02:00
parent c21d8532bc
commit 0454dcbfd5
16 changed files with 150 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.widget.TextView; import android.widget.TextView;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@@ -169,6 +170,10 @@ public class Activity extends Context {
});*/ });*/
} }
public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
setContentView(view);
}
public void setContentView(View view) { public void setContentView(View view) {
window.setContentView(view); window.setContentView(view);
} }

View File

@@ -1383,8 +1383,12 @@ public class PackageManager {
* @see #GET_UNINSTALLED_PACKAGES * @see #GET_UNINSTALLED_PACKAGES
*/ */
public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException { public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException {
return new PackageInfo(); PackageInfo packageInfo = new PackageInfo();
} if ((flags & GET_SIGNATURES) == GET_SIGNATURES) {
packageInfo.signatures = new Signature[0];
}
return packageInfo;
}
/** /**
* Map from the current package names in use on the device to whatever * Map from the current package names in use on the device to whatever

View File

@@ -0,0 +1,27 @@
package android.gesture;
import android.content.Context;
import android.view.ViewGroup;
public class GestureOverlayView extends ViewGroup {
public GestureOverlayView(Context context) {
}
public void setGestureStrokeType(int type) {
}
public void setEventsInterceptionEnabled(boolean enabled) {
}
public void setGestureVisible(boolean enabled) {
}
public void addOnGesturePerformedListener(OnGesturePerformedListener listener) {
}
public interface OnGesturePerformedListener {
}
}

View File

@@ -0,0 +1,10 @@
package android.gesture;
import java.io.InputStream;
public class GestureStore {
public void load(InputStream inputStream) {
}
}

View File

@@ -119,7 +119,7 @@ public final class Trace {
* synchronized, and sEnabledTags is volatile (prevents word tearing). * synchronized, and sEnabledTags is volatile (prevents word tearing).
*/ */
private static long cacheEnabledTags() { private static long cacheEnabledTags() {
long tags = nativeGetEnabledTags(); long tags = 0;
sEnabledTags = tags; sEnabledTags = tags;
return tags; return tags;
} }

View File

@@ -1621,7 +1621,9 @@ public final class MotionEvent extends InputEvent {
} }
MotionEvent ev = obtain(); MotionEvent ev = obtain();
ev.mNativePtr = nativeCopy(ev.mNativePtr, other.mNativePtr, true /*keepHistory*/); ev.action = other.action;
ev.coord_x = other.coord_x;
ev.coord_y = other.coord_y;
return ev; return ev;
} }

View File

@@ -872,4 +872,7 @@ public class View extends Object {
public Context getContext() { public Context getContext() {
return this.context; return this.context;
} }
public void refreshDrawableState() {
}
} }

View File

@@ -66,6 +66,16 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
// TODO: actually implement this (might make sense to implement it in the subclasses instead), when applicable // TODO: actually implement this (might make sense to implement it in the subclasses instead), when applicable
} }
/**
* Returns the number of children in the group.
*
* @return a positive integer representing the number of children in
* the group
*/
public int getChildCount() {
return children.size();
}
public static class LayoutParams { public static class LayoutParams {
public static final int FILL_PARENT = -1; public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1; public static final int MATCH_PARENT = -1;
@@ -98,4 +108,19 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
*/ */
// public LayoutAnimationController.AnimationParameters layoutAnimationParameters; // public LayoutAnimationController.AnimationParameters layoutAnimationParameters;
} }
public static class MarginLayoutParams extends ViewGroup.LayoutParams{
public MarginLayoutParams() {
super();
}
public MarginLayoutParams(int width, int height) {
super(width, height);
}
public MarginLayoutParams(int width, int height, float weight) {
super(width, height, weight);
}
}
} }

View File

@@ -39,4 +39,8 @@ public class Window {
public void takeInputQueue(InputQueue.Callback callback) { public void takeInputQueue(InputQueue.Callback callback) {
take_input_queue(native_window, callback, new InputQueue()); take_input_queue(native_window, callback, new InputQueue());
} }
public boolean requestFeature(int featureId) {
return false;
}
} }

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.webkit;
public interface DownloadListener {
/**
* Notify the host application that a file should be downloaded
* @param url The full url to the content that should be downloaded
* @param userAgent the user agent to be used for the download.
* @param contentDisposition Content-disposition http header, if
* present.
* @param mimetype The mimetype of the content reported by the server
* @param contentLength The file size reported by the server
*/
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype, long contentLength);
}

View File

@@ -4,4 +4,16 @@ public class WebSettings {
public String getUserAgentString() { public String getUserAgentString() {
return "FUCK YOU"; return "FUCK YOU";
} }
public void setUserAgentString(String userAgentString) {
}
public void setSupportMultipleWindows(boolean supportMultipleWindows) {
}
public void setJavaScriptEnabled(boolean javaScriptEnabled) {
}
public void setSavePassword(boolean savePassword) {
}
} }

View File

@@ -1,13 +1,24 @@
package android.webkit; package android.webkit;
import android.content.Context; import android.content.Context;
import android.view.View;
// the only reason we need to implement this is that some app developers are such scumbags that they try to use this for tracking purposes // the only reason we need to implement this is that some app developers are such scumbags that they try to use this for tracking purposes
public class WebView { public class WebView extends View {
public WebView (Context context) { public WebView (Context context) {
super(context);
} }
public WebSettings getSettings() { public WebSettings getSettings() {
return new WebSettings(); return new WebSettings();
} }
public void setDownloadListener(DownloadListener downloadListener) {
}
public void setScrollBarStyle(int scrollBarStyle) {
}
public void setWebViewClient(WebViewClient webViewClient) {
}
} }

View File

@@ -0,0 +1,4 @@
package android.webkit;
public class WebViewClient {
}

View File

@@ -31,7 +31,7 @@ public class FrameLayout extends ViewGroup {
addView(child, index, null); addView(child, index, null);
} }
public static class LayoutParams extends ViewGroup.LayoutParams { public static class LayoutParams extends ViewGroup.MarginLayoutParams {
public LayoutParams(int width, int height) { public LayoutParams(int width, int height) {
super(width, height); super(width, height);
} }

View File

@@ -38,6 +38,10 @@ public class RelativeLayout extends ViewGroup {
super(width, height, weight); super(width, height, weight);
} }
public LayoutParams(ViewGroup.MarginLayoutParams source) {
super(source.width, source.height, source.weight);
}
public void addRule(int verb) {} public void addRule(int verb) {}
public void addRule(int verb, int anchor) {} public void addRule(int verb, int anchor) {}
} }

View File

@@ -76,6 +76,8 @@ hax_jar = jar('hax', [
'android/database/sqlite/SQLiteOpenHelper.java', 'android/database/sqlite/SQLiteOpenHelper.java',
'android/database/sqlite/SQLiteProgram.java', 'android/database/sqlite/SQLiteProgram.java',
'android/database/sqlite/SQLiteQuery.java', 'android/database/sqlite/SQLiteQuery.java',
'android/gesture/GestureOverlayView.java',
'android/gesture/GestureStore.java',
'android/graphics/BitmapFactory.java', 'android/graphics/BitmapFactory.java',
'android/graphics/Bitmap.java', 'android/graphics/Bitmap.java',
'android/graphics/Canvas.java', 'android/graphics/Canvas.java',
@@ -204,8 +206,10 @@ hax_jar = jar('hax', [
'android/view/Window.java', 'android/view/Window.java',
'android/view/WindowManagerImpl.java', 'android/view/WindowManagerImpl.java',
'android/view/WindowManager.java', 'android/view/WindowManager.java',
'android/webkit/DownloadListener.java',
'android/webkit/WebSettings.java', 'android/webkit/WebSettings.java',
'android/webkit/WebView.java', 'android/webkit/WebView.java',
'android/webkit/WebViewClient.java',
'android/widget/EditText.java', 'android/widget/EditText.java',
'android/widget/FrameLayout.java', 'android/widget/FrameLayout.java',
'android/widget/ImageView.java', 'android/widget/ImageView.java',