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
add lots of java APIs needed for Whatsapp
This commit is contained in:
@@ -17,3 +17,10 @@ JNIEXPORT jlong JNICALL Java_android_os_SystemClock_uptimeMillis(JNIEnv *env, jc
|
|||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
return now.tv_sec * 1000 + lround(now.tv_nsec / 1e6);
|
return now.tv_sec * 1000 + lround(now.tv_nsec / 1e6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_android_os_SystemClock_elapsedRealtimeNanos(JNIEnv *env, jclass this)
|
||||||
|
{
|
||||||
|
struct timespec t;
|
||||||
|
clock_gettime(CLOCK_BOOTTIME, &t);
|
||||||
|
return t.tv_sec * 1000000000 + t.tv_nsec;
|
||||||
|
}
|
||||||
|
|||||||
@@ -273,14 +273,6 @@ JNIEXPORT void JNICALL Java_android_os_Process_readProcLines
|
|||||||
JNIEXPORT jintArray JNICALL Java_android_os_Process_getPids
|
JNIEXPORT jintArray JNICALL Java_android_os_Process_getPids
|
||||||
(JNIEnv *, jclass, jstring, jintArray);
|
(JNIEnv *, jclass, jstring, jintArray);
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: android_os_Process
|
|
||||||
* Method: readProcFile
|
|
||||||
* Signature: (Ljava/lang/String;[I[Ljava/lang/String;[J[F)Z
|
|
||||||
*/
|
|
||||||
JNIEXPORT jboolean JNICALL Java_android_os_Process_readProcFile
|
|
||||||
(JNIEnv *, jclass, jstring, jintArray, jobjectArray, jlongArray, jfloatArray);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_os_Process
|
* Class: android_os_Process
|
||||||
* Method: parseProcLine
|
* Method: parseProcLine
|
||||||
|
|||||||
@@ -27,4 +27,6 @@ public class Animator {
|
|||||||
|
|
||||||
public Animator setDuration(long duration) { return this; }
|
public Animator setDuration(long duration) { return this; }
|
||||||
|
|
||||||
|
public void setInterpolator(TimeInterpolator i) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,8 @@ public class PropertyValuesHolder{
|
|||||||
public static PropertyValuesHolder ofFloat(String propertyName, float... values) {
|
public static PropertyValuesHolder ofFloat(String propertyName, float... values) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PropertyValuesHolder ofObject(String propertyName, TypeEvaluator evaluator, Object... values) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package android.app;
|
|||||||
import android.R;
|
import android.R;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.ContextWrapper;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageParser;
|
import android.content.pm.PackageParser;
|
||||||
@@ -12,6 +12,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -28,7 +29,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Activity extends ContextWrapper implements Window.Callback {
|
public class Activity extends ContextThemeWrapper implements Window.Callback {
|
||||||
LayoutInflater layout_inflater;
|
LayoutInflater layout_inflater;
|
||||||
Window window = new Window(this);
|
Window window = new Window(this);
|
||||||
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
|
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
|
||||||
@@ -54,7 +55,7 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
if (className == null) {
|
if (className == null) {
|
||||||
for (PackageParser.Activity activity: pkg.activities) {
|
for (PackageParser.Activity activity: pkg.activities) {
|
||||||
for (PackageParser.IntentInfo intent: activity.intents) {
|
for (PackageParser.IntentInfo intent: activity.intents) {
|
||||||
if (intent.matchAction("android.intent.action.MAIN")) {
|
if (intent.hasCategory("android.intent.category.LAUNCHER")) {
|
||||||
className = activity.className;
|
className = activity.className;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -74,23 +75,27 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
|
|
||||||
public Activity() {
|
public Activity() {
|
||||||
super(null);
|
super(null);
|
||||||
layout_inflater = new LayoutInflater();
|
layout_inflater = new LayoutInflater(this);
|
||||||
intent = new Intent();
|
intent = new Intent();
|
||||||
|
|
||||||
CharSequence label = null;
|
CharSequence label = null;
|
||||||
CharSequence app_label = null;
|
CharSequence app_label = null;
|
||||||
|
int themeResId = 0;
|
||||||
for (PackageParser.Activity activity: pkg.activities) {
|
for (PackageParser.Activity activity: pkg.activities) {
|
||||||
if (getClass().getName().equals(activity.className)) {
|
if (getClass().getName().equals(activity.className)) {
|
||||||
label = getText(activity.info.labelRes);
|
label = r.getText(activity.info.labelRes);
|
||||||
|
themeResId = activity.info.getThemeResource();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app_label = getText(pkg.applicationInfo.labelRes);
|
app_label = r.getText(pkg.applicationInfo.labelRes);
|
||||||
if (label != null) {
|
if (label != null) {
|
||||||
setTitle(label);
|
setTitle(label);
|
||||||
} else if (app_label != null) {
|
} else if (app_label != null) {
|
||||||
setTitle(app_label);
|
setTitle(app_label);
|
||||||
}
|
}
|
||||||
|
attachBaseContext(new Context());
|
||||||
|
setTheme(themeResId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public View root_view;
|
public View root_view;
|
||||||
@@ -422,6 +427,10 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTitle(int titleId) {
|
||||||
|
this.title = getText(titleId);
|
||||||
|
}
|
||||||
|
|
||||||
public CharSequence getTitle() {
|
public CharSequence getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
@@ -488,6 +497,10 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
return destroyed;
|
return destroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void finishAffinity() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
private native void nativeFinish(long native_window);
|
private native void nativeFinish(long native_window);
|
||||||
public static native void nativeRecreateActivity(Activity activity);
|
public static native void nativeRecreateActivity(Activity activity);
|
||||||
public static native void nativeStartActivity(Activity activity);
|
public static native void nativeStartActivity(Activity activity);
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ActivityManager {
|
public class ActivityManager {
|
||||||
|
|
||||||
public static class RunningAppProcessInfo{}
|
public static class RunningAppProcessInfo{
|
||||||
|
public int importance;
|
||||||
|
}
|
||||||
|
|
||||||
public List<RunningAppProcessInfo> getRunningAppProcesses() {
|
public List<RunningAppProcessInfo> getRunningAppProcesses() {
|
||||||
return null;
|
return null;
|
||||||
@@ -16,6 +18,8 @@ public class ActivityManager {
|
|||||||
public static class MemoryInfo {
|
public static class MemoryInfo {
|
||||||
/* For now, just always report there's 10GB free RAM */
|
/* For now, just always report there's 10GB free RAM */
|
||||||
public long availMem = 10000;
|
public long availMem = 10000;
|
||||||
|
|
||||||
|
public long totalMem = 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getMemoryInfo(MemoryInfo outInfo)
|
public void getMemoryInfo(MemoryInfo outInfo)
|
||||||
@@ -26,4 +30,8 @@ public class ActivityManager {
|
|||||||
public ConfigurationInfo getDeviceConfigurationInfo() {
|
public ConfigurationInfo getDeviceConfigurationInfo() {
|
||||||
return new ConfigurationInfo();
|
return new ConfigurationInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMemoryClass() {return 20;} // suggested heap size in MB
|
||||||
|
|
||||||
|
public static void getMyMemoryState(RunningAppProcessInfo outInfo) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,8 @@ package android.app;
|
|||||||
|
|
||||||
public class AlarmManager {
|
public class AlarmManager {
|
||||||
public void cancel(PendingIntent operation) {}
|
public void cancel(PendingIntent operation) {}
|
||||||
|
|
||||||
|
public void setInexactRepeating(int type, long triggerTime, long interval, PendingIntent operation) {}
|
||||||
|
|
||||||
|
public void setExact(int type, long triggerTime, PendingIntent operation) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class Application extends ContextWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Application() {
|
public Application() {
|
||||||
super(new Context());
|
super(null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Called when the application is starting, before any activity, service,
|
* Called when the application is starting, before any activity, service,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class Dialog implements Window.Callback, DialogInterface {
|
|||||||
private Context context;
|
private Context context;
|
||||||
private Window window;
|
private Window window;
|
||||||
private OnDismissListener onDismissListener;
|
private OnDismissListener onDismissListener;
|
||||||
|
private OnShowListener onShowListener;
|
||||||
|
|
||||||
public Dialog(Context context, int themeResId) {
|
public Dialog(Context context, int themeResId) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -75,6 +76,8 @@ public class Dialog implements Window.Callback, DialogInterface {
|
|||||||
public void run() {
|
public void run() {
|
||||||
onCreate(null);
|
onCreate(null);
|
||||||
nativeShow(nativePtr);
|
nativeShow(nativePtr);
|
||||||
|
if (onShowListener != null)
|
||||||
|
onShowListener.onShow(Dialog.this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(Looper.myLooper() == Looper.getMainLooper()) {
|
if(Looper.myLooper() == Looper.getMainLooper()) {
|
||||||
@@ -160,4 +163,8 @@ public class Dialog implements Window.Callback, DialogInterface {
|
|||||||
public void cancel() {
|
public void cancel() {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnShowListener(OnShowListener onShowListener) {
|
||||||
|
this.onShowListener = onShowListener;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,8 @@ public class KeyguardManager {
|
|||||||
public boolean inKeyguardRestrictedInputMode() {
|
public boolean inKeyguardRestrictedInputMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isKeyguardLocked() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
public class NotificationManager {
|
public class NotificationManager {
|
||||||
public void cancelAll() {}
|
public void cancelAll() {}
|
||||||
@@ -40,7 +41,7 @@ public class NotificationManager {
|
|||||||
public void cancel(String tag, final int id) {
|
public void cancel(String tag, final int id) {
|
||||||
// remove_notification doesn't work reliably when sent directly after add_notification in GNOME session.
|
// remove_notification doesn't work reliably when sent directly after add_notification in GNOME session.
|
||||||
// So we give some extra delay here.
|
// So we give some extra delay here.
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
nativeCancel(id);
|
nativeCancel(id);
|
||||||
|
|||||||
@@ -25,4 +25,12 @@ public abstract class Service extends Context {
|
|||||||
public Application getApplication() {
|
public Application getApplication() {
|
||||||
return this_application;
|
return this_application;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopSelf(int startId) {
|
||||||
|
System.out.println("Service.stopSelf(" + startId + ") called");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopSelf() {
|
||||||
|
System.out.println("Service.stopSelf() called");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/api-impl/android/bluetooth/BluetoothAdapter.java
Normal file
8
src/api-impl/android/bluetooth/BluetoothAdapter.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package android.bluetooth;
|
||||||
|
|
||||||
|
public class BluetoothAdapter {
|
||||||
|
|
||||||
|
public static BluetoothAdapter getDefaultAdapter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/api-impl/android/bluetooth/BluetoothProfile.java
Normal file
6
src/api-impl/android/bluetooth/BluetoothProfile.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package android.bluetooth;
|
||||||
|
|
||||||
|
public class BluetoothProfile {
|
||||||
|
|
||||||
|
public interface ServiceListener {}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ public class ContentProvider {
|
|||||||
public boolean onCreate() {return false;}
|
public boolean onCreate() {return false;}
|
||||||
|
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
return Context.this_application;
|
return new Context();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import android.telephony.TelephonyManager;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.view.Display;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.WindowManagerImpl;
|
import android.view.WindowManagerImpl;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
@@ -128,6 +129,7 @@ public class Context extends Object {
|
|||||||
application.setTheme(pkg.applicationInfo.theme);
|
application.setTheme(pkg.applicationInfo.theme);
|
||||||
application.native_window = native_window;
|
application.native_window = native_window;
|
||||||
this_application = application;
|
this_application = application;
|
||||||
|
application.attachBaseContext(new Context());
|
||||||
return application;
|
return application;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +201,7 @@ public class Context extends Object {
|
|||||||
case "accessibility":
|
case "accessibility":
|
||||||
return new AccessibilityManager();
|
return new AccessibilityManager();
|
||||||
case "layout_inflater":
|
case "layout_inflater":
|
||||||
return new LayoutInflater();
|
return new LayoutInflater(getApplicationContext());
|
||||||
case "wifi":
|
case "wifi":
|
||||||
return new WifiManager();
|
return new WifiManager();
|
||||||
default:
|
default:
|
||||||
@@ -214,14 +216,7 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Looper getMainLooper() {
|
public Looper getMainLooper() {
|
||||||
/* TODO: this is not what AOSP does, which could be a problem */
|
return Looper.getMainLooper();
|
||||||
Looper looper = Looper.myLooper();
|
|
||||||
if(looper == null) {
|
|
||||||
Looper.prepare();
|
|
||||||
looper = Looper.myLooper();
|
|
||||||
}
|
|
||||||
|
|
||||||
return looper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public String getPackageName() {
|
||||||
@@ -452,7 +447,7 @@ public class Context extends Object {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Handler().post(new Runnable() { // run this asynchron so the caller can finish its setup before onServiceConnected is called
|
new Handler(Looper.getMainLooper()).post(new Runnable() { // run this asynchron so the caller can finish its setup before onServiceConnected is called
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@@ -490,15 +485,26 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
final Intent intent_ = intent;
|
||||||
Class<? extends Activity> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Activity.class);
|
Runnable runnable = new Runnable() {
|
||||||
Constructor<? extends Activity> constructor = cls.getConstructor();
|
@Override
|
||||||
Activity activity = constructor.newInstance();
|
public void run() {
|
||||||
activity.intent = intent;
|
try {
|
||||||
activity.getWindow().native_window = this_application.native_window;
|
Class<? extends Activity> cls = Class.forName(intent_.getComponent().getClassName()).asSubclass(Activity.class);
|
||||||
Activity.nativeStartActivity(activity);
|
Constructor<? extends Activity> constructor = cls.getConstructor();
|
||||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
Activity activity = constructor.newInstance();
|
||||||
e.printStackTrace();
|
activity.intent = intent_;
|
||||||
|
activity.getWindow().native_window = this_application.native_window;
|
||||||
|
Activity.nativeStartActivity(activity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||||
|
runnable.run();
|
||||||
|
} else {
|
||||||
|
new Handler(Looper.getMainLooper()).post(runnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,6 +582,18 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Context createConfigurationContext(Configuration configuration) {
|
public Context createConfigurationContext(Configuration configuration) {
|
||||||
return this;
|
return new Context();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendOrderedBroadcast(Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler handler, int flags, String extra, Bundle options) {
|
||||||
|
System.out.println("sendOrderedBroadcast(" + intent + ", " + receiverPermission + ", " + resultReceiver + ", " + handler + ", " + flags + ", " + extra + ", " + options + ") called");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context createDisplayContext(Display display) {
|
||||||
|
return new Context();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) {
|
||||||
|
return registerReceiver(receiver, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,9 @@ public class ContextWrapper extends Context {
|
|||||||
public Context getBaseContext() {
|
public Context getBaseContext() {
|
||||||
return baseContext;
|
return baseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void attachBaseContext(Context baseContext) {
|
||||||
|
this.baseContext = baseContext;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public interface DialogInterface {
|
|||||||
void onClick(DialogInterface dialog, int which);
|
void onClick(DialogInterface dialog, int which);
|
||||||
}
|
}
|
||||||
public interface OnShowListener {
|
public interface OnShowListener {
|
||||||
|
void onShow(DialogInterface dialog);
|
||||||
}
|
}
|
||||||
public interface OnCancelListener {
|
public interface OnCancelListener {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,4 +314,8 @@ public class Intent {
|
|||||||
public ArrayList<Parcelable> getParcelableArrayListExtra(String name) {
|
public ArrayList<Parcelable> getParcelableArrayListExtra(String name) {
|
||||||
return extras.getParcelableArrayList(name);
|
return extras.getParcelableArrayList(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPackage() {
|
||||||
|
return component.getPackageName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package android.content;
|
package android.content;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class IntentFilter {
|
public class IntentFilter {
|
||||||
|
|
||||||
private Set<String> actions = new HashSet<>();
|
private List<String> actions = new ArrayList<>();
|
||||||
|
private Set<String> categories = new HashSet<>();
|
||||||
|
|
||||||
public IntentFilter() {}
|
public IntentFilter() {}
|
||||||
public IntentFilter(String action) {
|
public IntentFilter(String action) {
|
||||||
@@ -22,4 +25,19 @@ public class IntentFilter {
|
|||||||
public final boolean matchAction(String action) {
|
public final boolean matchAction(String action) {
|
||||||
return actions.contains(action);
|
return actions.contains(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addCategory(String category) {
|
||||||
|
categories.add(category);
|
||||||
|
}
|
||||||
|
public int countCategories() {
|
||||||
|
return categories.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean hasCategory(String category) {
|
||||||
|
return categories.contains(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAction(int index) {
|
||||||
|
return actions.get(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user