You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl: stubs and fixes for latest WhatsApp version
This commit is contained in:
committed by
Julian Winkler
parent
09a38f9a28
commit
c81442321e
@@ -109,6 +109,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
|||||||
'src/api-impl-jni/media/android_media_MediaCodec.c',
|
'src/api-impl-jni/media/android_media_MediaCodec.c',
|
||||||
'src/api-impl-jni/media/android_media_session_MediaSession.c',
|
'src/api-impl-jni/media/android_media_session_MediaSession.c',
|
||||||
'src/api-impl-jni/net/android_net_ConnectivityManager.c',
|
'src/api-impl-jni/net/android_net_ConnectivityManager.c',
|
||||||
|
'src/api-impl-jni/os/android_os_Process.c',
|
||||||
'src/api-impl-jni/sensors/android_hardware_SensorManager.c',
|
'src/api-impl-jni/sensors/android_hardware_SensorManager.c',
|
||||||
'src/api-impl-jni/util.c',
|
'src/api-impl-jni/util.c',
|
||||||
'src/api-impl-jni/views/AndroidLayout.c',
|
'src/api-impl-jni/views/AndroidLayout.c',
|
||||||
|
|||||||
@@ -297,6 +297,14 @@ JNIEXPORT jintArray JNICALL Java_android_os_Process_getPidsForCommands
|
|||||||
JNIEXPORT jlong JNICALL Java_android_os_Process_getPss
|
JNIEXPORT jlong JNICALL Java_android_os_Process_getPss
|
||||||
(JNIEnv *, jclass, jint);
|
(JNIEnv *, jclass, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: android_os_Process
|
||||||
|
* Method: is64Bit
|
||||||
|
* Signature: ()Z
|
||||||
|
*/
|
||||||
|
JNIEXPORT jboolean JNICALL Java_android_os_Process_is64Bit
|
||||||
|
(JNIEnv *, jclass);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
10
src/api-impl-jni/os/android_os_Process.c
Normal file
10
src/api-impl-jni/os/android_os_Process.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "../generated_headers/android_os_Process.h"
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL Java_android_os_Process_is64Bit(JNIEnv *env, jclass this)
|
||||||
|
{
|
||||||
|
#ifdef __LP64__
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -576,4 +576,14 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
public void setDefaultKeyMode(int flag) {}
|
public void setDefaultKeyMode(int flag) {}
|
||||||
public void registerForContextMenu(View view) {}
|
public void registerForContextMenu(View view) {}
|
||||||
public native boolean isInMultiWindowMode();
|
public native boolean isInMultiWindowMode();
|
||||||
|
|
||||||
|
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {}
|
||||||
|
|
||||||
|
public void setDisablePreviewScreenshots(boolean disable) {}
|
||||||
|
public final View requireViewById(int id) {
|
||||||
|
View view = findViewById(id);
|
||||||
|
if (view == null)
|
||||||
|
throw new IllegalArgumentException("ID does not reference a View inside this View");
|
||||||
|
return view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.os.Parcelable;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class ActivityManager {
|
public class ActivityManager {
|
||||||
|
|
||||||
@@ -80,4 +81,8 @@ public class ActivityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getLargeMemoryClass() {return getMemoryClass();}
|
public int getLargeMemoryClass() {return getMemoryClass();}
|
||||||
|
|
||||||
|
public List<ApplicationExitInfo> getHistoricalProcessExitReasons(String pkgname, int pid, int maxNum) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ public class AlarmManager {
|
|||||||
public void setExact(int type, long triggerTime, PendingIntent operation) {}
|
public void setExact(int type, long triggerTime, PendingIntent operation) {}
|
||||||
|
|
||||||
public void set(int type, long triggerTime, PendingIntent operation) {}
|
public void set(int type, long triggerTime, PendingIntent operation) {}
|
||||||
|
|
||||||
|
public void setExactAndAllowWhileIdle(int type, long triggerAtMillis, PendingIntent operation) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,8 @@ public class Application extends ContextWrapper {
|
|||||||
}
|
}
|
||||||
public void unregisterOnProvideAssistDataListener(OnProvideAssistDataListener callback) {
|
public void unregisterOnProvideAssistDataListener(OnProvideAssistDataListener callback) {
|
||||||
}
|
}
|
||||||
|
public static String getProcessName() {
|
||||||
|
// note: we currently don't set the process name
|
||||||
|
return Context.this_application.getPackageName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/api-impl/android/app/ApplicationExitInfo.java
Normal file
4
src/api-impl/android/app/ApplicationExitInfo.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package android.app;
|
||||||
|
|
||||||
|
public class ApplicationExitInfo {
|
||||||
|
}
|
||||||
@@ -1,6 +1,22 @@
|
|||||||
package android.app;
|
package android.app;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
|
|
||||||
public class NotificationChannel {
|
public class NotificationChannel {
|
||||||
|
|
||||||
public NotificationChannel(String id, CharSequence name, int importance) {}
|
public NotificationChannel(String id, CharSequence name, int importance) {}
|
||||||
|
|
||||||
|
public void setLockscreenVisibility(int a) {}
|
||||||
|
public void setShowBadge(boolean a) {}
|
||||||
|
public void setGroup(String grp) {}
|
||||||
|
public void enableLights(boolean en) {}
|
||||||
|
public void setLightColor(int color) {}
|
||||||
|
public void setVibrationPattern(long[] pattern) {}
|
||||||
|
public void enableVibration(boolean en) {}
|
||||||
|
public void setSound(Uri uri, AudioAttributes attrs) {}
|
||||||
|
public boolean shouldShowLights() { return false; }
|
||||||
|
public int getLightColor() { return 0; }
|
||||||
|
public boolean shouldVibrate() { return false; }
|
||||||
|
public Uri getSound() { return null; }
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/api-impl/android/app/NotificationChannelGroup.java
Normal file
6
src/api-impl/android/app/NotificationChannelGroup.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package android.app;
|
||||||
|
|
||||||
|
public class NotificationChannelGroup {
|
||||||
|
public NotificationChannelGroup(String a, CharSequence b) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package android.app;
|
package android.app;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -106,4 +108,14 @@ public class NotificationManager {
|
|||||||
protected native void nativeShowMPRIS(String packageName, String identiy);
|
protected native void nativeShowMPRIS(String packageName, String identiy);
|
||||||
protected native void nativeCancel(int id);
|
protected native void nativeCancel(int id);
|
||||||
protected native void nativeCancelMPRIS();
|
protected native void nativeCancelMPRIS();
|
||||||
|
|
||||||
|
public void createNotificationChannelGroup(NotificationChannelGroup v) {}
|
||||||
|
|
||||||
|
public List<NotificationChannel> getNotificationChannels() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NotificationChannelGroup> getNotificationChannelGroups() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package android.app.job;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
|
||||||
public class JobInfo {
|
public class JobInfo {
|
||||||
|
|
||||||
|
public JobInfo() {}
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
public Builder(int jobId, ComponentName jobService) {}
|
public Builder(int jobId, ComponentName jobService) {}
|
||||||
|
|
||||||
@@ -13,5 +16,13 @@ public class JobInfo {
|
|||||||
public Builder setRequiredNetworkType(int networkType) {
|
public Builder setRequiredNetworkType(int networkType) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setOverrideDeadline(long a) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JobInfo build() {
|
||||||
|
return new JobInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ public class JobScheduler {
|
|||||||
public List<JobInfo> getAllPendingJobs() {
|
public List<JobInfo> getAllPendingJobs() {
|
||||||
return new ArrayList<JobInfo>();
|
return new ArrayList<JobInfo>();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public int enqueue(JobInfo job, JobWorkItem work) {
|
||||||
|
return 1; //RESULT_SUCCESS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/api-impl/android/app/job/JobWorkItem.java
Normal file
9
src/api-impl/android/app/job/JobWorkItem.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package android.app.job;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
final public class JobWorkItem {
|
||||||
|
public JobWorkItem(Intent intent) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ import android.bluetooth.BluetoothManager;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageParser;
|
import android.content.pm.PackageParser;
|
||||||
|
import android.content.pm.ShortcutManager;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -39,6 +40,7 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -386,6 +388,10 @@ public class Context extends Object {
|
|||||||
return prefs_dir;
|
return prefs_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File[] getExternalMediaDirs() {
|
||||||
|
return getExternalFilesDirs("media");
|
||||||
|
}
|
||||||
|
|
||||||
public File getDir(String name, int mode) {
|
public File getDir(String name, int mode) {
|
||||||
File dir = new File(getFilesDir(), name);
|
File dir = new File(getFilesDir(), name);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
@@ -656,4 +662,11 @@ public class Context extends Object {
|
|||||||
public void revokeUriPermission(Uri uri, int mode) {
|
public void revokeUriPermission(Uri uri, int mode) {
|
||||||
System.out.println("revokeUriPermission(" + uri + ", " + mode + ") called");
|
System.out.println("revokeUriPermission(" + uri + ", " + mode + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAttributionTag() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public boolean isDeviceProtectedStorage() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,4 +364,8 @@ public class Intent implements Parcelable {
|
|||||||
public byte[] getByteArrayExtra(String name) {
|
public byte[] getByteArrayExtra(String name) {
|
||||||
return extras.getByteArray(name);
|
return extras.getByteArray(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeExtra(String name) {
|
||||||
|
extras.remove(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,4 +243,10 @@ public class PackageInfo {
|
|||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLongVersionCode() {
|
||||||
|
return versionCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SigningInfo signingInfo = new SigningInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/api-impl/android/content/pm/ShortcutManager.java
Normal file
15
src/api-impl/android/content/pm/ShortcutManager.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package android.content.pm;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ShortcutManager {
|
||||||
|
public void removeAllDynamicShortcuts() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public List getShortcuts(int matchFlags) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
public void removeLongLivedShortcuts(List<String> shortcutIds) {
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/api-impl/android/content/pm/SigningInfo.java
Normal file
7
src/api-impl/android/content/pm/SigningInfo.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package android.content.pm;
|
||||||
|
|
||||||
|
public final class SigningInfo {
|
||||||
|
public Signature[] getApkContentsSigners() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1471,6 +1471,8 @@ public class Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final AssetManager mAssets;
|
private final AssetManager mAssets;
|
||||||
|
|
||||||
|
public void rebase() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user