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
multiple additions and fixes for the Java APIs
Stuff needed for WhatsApp support
This commit is contained in:
@@ -44,4 +44,8 @@ public class ContentResolver {
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) {
|
||||
return query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
}
|
||||
|
||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,17 +405,24 @@ public class Context extends Object {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Class<? extends Service> cls = Class.forName(component.getClassName()).asSubclass(Service.class);
|
||||
if (!runningServices.containsKey(cls)) {
|
||||
Service service = cls.getConstructor().newInstance();
|
||||
service.onCreate();
|
||||
runningServices.put(cls, service);
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<? extends Service> cls = Class.forName(component.getClassName()).asSubclass(Service.class);
|
||||
if (!runningServices.containsKey(cls)) {
|
||||
Service service = cls.getConstructor().newInstance();
|
||||
service.onCreate();
|
||||
runningServices.put(cls, service);
|
||||
}
|
||||
|
||||
runningServices.get(cls).onStartCommand(intent, 0, 0);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
runningServices.get(cls).onStartCommand(intent, 0, 0);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -603,4 +610,12 @@ public class Context extends Object {
|
||||
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) {
|
||||
return registerReceiver(receiver, filter);
|
||||
}
|
||||
|
||||
public String[] fileList() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
public void revokeUriPermission(Uri uri, int mode) {
|
||||
System.out.println("revokeUriPermission(" + uri + ", " + mode + ") called");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,6 @@ public interface DialogInterface {
|
||||
}
|
||||
public interface OnMultiChoiceClickListener {
|
||||
}
|
||||
public interface OnKeyListener {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,4 +318,15 @@ public class Intent {
|
||||
public String getPackage() {
|
||||
return component.getPackageName();
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return data == null ? null : data.getScheme();
|
||||
}
|
||||
|
||||
public static class ShortcutIconResource {
|
||||
|
||||
public static ShortcutIconResource fromContext(Context context, int id) {
|
||||
return new ShortcutIconResource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +40,6 @@ public class IntentFilter {
|
||||
public String getAction(int index) {
|
||||
return actions.get(index);
|
||||
}
|
||||
|
||||
public void setPriority(int priority) {}
|
||||
}
|
||||
|
||||
@@ -2411,13 +2411,14 @@ public class PackageManager {
|
||||
* else null.
|
||||
* @throws Exception
|
||||
*/
|
||||
public ProviderInfo resolveContentProvider(String authority, int flags) throws Exception {
|
||||
public ProviderInfo resolveContentProvider(String authority, int flags) {
|
||||
for (PackageParser.Provider p : Context.pkg.providers) {
|
||||
if (p.info.authority.equals(authority))
|
||||
return p.info;
|
||||
}
|
||||
|
||||
throw new Exception("Provider not found: " + authority);
|
||||
Slog.w(TAG, "Provider not found: " + authority);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3031,6 +3031,7 @@ public class PackageParser {
|
||||
outError)) == null) {
|
||||
return null;
|
||||
}
|
||||
s.info.metaData = s.metaData;
|
||||
} else {
|
||||
if (!RIGID_PARSER) {
|
||||
Slog.w(TAG, "Unknown element under <service>: " + parser.getName() + " at " + mArchiveSourcePath + " " + parser.getPositionDescription());
|
||||
|
||||
Reference in New Issue
Block a user