public static int copyNativeBinaries(File apkFile, File sharedLibraryDir) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return copyNativeBinariesAfterL(apkFile, sharedLibraryDir); } else { return copyNativeBinariesBeforeL(apkFile, sharedLibraryDir); } }
private static RefStaticMethod<IInterface> getInterfaceMethod() { if (BuildCompat.isOreo()) { return IStorageManager.Stub.asInterface; } else { return IMountService.Stub.asInterface; } } }
/** * Return first index of {@code value} in {@code array}, or {@code -1} if * not found. */ public static <T> int indexOf(T[] array, T value) { if (array == null) return -1; for (int i = 0; i < array.length; i++) { if (ObjectsCompat.equals(array[i], value)) return i; } return -1; }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String processName = (String) args[0]; int uid = (int) args[1]; int flags = (int) args[2]; List<ProviderInfo> infos = VPackageManager.get().queryContentProviders(processName, uid, flags); if (ParceledListSliceCompat.isReturnParceledListSlice(method)) { return ParceledListSliceCompat.create(infos); } return infos; }
public static ContentProviderClient crazyAcquireContentProvider(Context context, String name) { ContentProviderClient client = acquireContentProviderClient(context, name); if (client == null) { int retry = 0; while (retry < 5 && client == null) { SystemClock.sleep(100); retry++; client = acquireContentProviderClient(context, name); } } return client; }
@Override public Bundle call(String method, String arg, Bundle extras) { if ("@".equals(method)) { Bundle bundle = new Bundle(); BundleCompat.putBinder(bundle, "_VA_|_binder_", mServiceFetcher); return bundle; } return null; }
public static boolean isOreo() { return (Build.VERSION.SDK_INT == 25 && getPreviewSDKInt() > 0) || Build.VERSION.SDK_INT > 25; }
public static String get(String key, String defaultValue) { try { return getInner(key, defaultValue); } catch (Exception var3) { var3.printStackTrace(); return defaultValue; } }
public static Bundle call(String authority, Context context, String method, String arg, Bundle bundle) { Uri uri = Uri.parse("content://" + authority); return ContentProviderCompat.call(context, uri, method, arg, bundle); }
@Override public void callActivityOnCreate(Activity activity, Bundle icicle, PersistableBundle persistentState) { if (icicle != null) { BundleCompat.clearParcelledData(icicle); } super.callActivityOnCreate(activity, icicle, persistentState); }
private static String getInner(String key, String defaultValue) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException { Class clazz = getSystemPropertiesClass(); return (String) Reflect.on(clazz).call("get", key, defaultValue).get(); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { int flags = (Integer) args[0]; int userId = VUserHandle.myUserId(); List<ApplicationInfo> appInfos = VPackageManager.get().getInstalledApplications(flags, userId); if (ParceledListSliceCompat.isReturnParceledListSlice(method)) { return ParceledListSliceCompat.create(appInfos); } return appInfos; } }
private static boolean isOreo() { return BuildCompat.isOreo() && !DeviceUtil.isSamsung() || ClipboardManager.getService == null; } }
@Override protected boolean allowFilterResult(VPackage.ActivityIntentInfo filter, List<ResolveInfo> dest) { ActivityInfo filterAi = filter.activity.info; for (int i = dest.size() - 1; i >= 0; i--) { ActivityInfo destAi = dest.get(i).activityInfo; if (ObjectsCompat.equals(destAi.name, filterAi.name) && ObjectsCompat.equals(destAi.packageName, filterAi.packageName)) { return false; } } return true; }
public static ContentProviderClient crazyAcquireContentProvider(Context context, Uri uri) { ContentProviderClient client = acquireContentProviderClient(context, uri); if (client == null) { int retry = 0; while (retry < 5 && client == null) { SystemClock.sleep(100); retry++; client = acquireContentProviderClient(context, uri); } } return client; }
public void setUiCallback(Intent intent, IUiCallback callback) { if (callback != null) { Bundle bundle = new Bundle(); BundleCompat.putBinder(bundle, "_VA_|_ui_callback_", callback.asBinder()); intent.putExtra("_VA_|_sender_", bundle); } }
public static IInterface asInterface(IBinder binder) { if (BuildCompat.isOreo()) { return IApplicationThreadOreo.Stub.asInterface.call(binder); } return ApplicationThreadNative.asInterface.call(binder); } }
@Override protected boolean allowFilterResult(VPackage.ServiceIntentInfo filter, List<ResolveInfo> dest) { ServiceInfo filterSi = filter.service.info; for (int i = dest.size() - 1; i >= 0; i--) { ServiceInfo destAi = dest.get(i).serviceInfo; if (ObjectsCompat.equals(destAi.name, filterSi.name) && ObjectsCompat.equals(destAi.packageName, filterSi.packageName)) { return false; } } return true; }
private static void clearContentProvider(Object cache) { if (BuildCompat.isOreo()) { Object holder = Settings.NameValueCacheOreo.mProviderHolder.get(cache); if (holder != null) { Settings.ContentProviderHolder.mContentProvider.set(holder, null); } } else { Settings.NameValueCache.mContentProvider.set(cache, null); } }
@TargetApi(Build.VERSION_CODES.KITKAT) @Override protected boolean allowFilterResult(VPackage.ProviderIntentInfo filter, List<ResolveInfo> dest) { ProviderInfo filterPi = filter.provider.info; for (int i = dest.size() - 1; i >= 0; i--) { ProviderInfo destPi = dest.get(i).providerInfo; if (ObjectsCompat.equals(destPi.name, filterPi.name) && ObjectsCompat.equals(destPi.packageName, filterPi.packageName)) { return false; } } return true; }