@Override public void notifyBadgerChange(BadgerInfo info) throws RemoteException { Intent intent = new Intent(VASettings.ACTION_BADGER_CHANGE); intent.putExtra("userId", info.userId); intent.putExtra("packageName", info.packageName); intent.putExtra("badgerCount", info.badgerCount); VirtualCore.get().getContext().sendBroadcast(intent); } }
private static ServiceInfo resolveServiceInfo(Intent service, int userId) { if (service != null) { ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, userId); if (serviceInfo != null) { return serviceInfo; } } return null; }
private IAppManager getService() { if (mService == null || (!VirtualCore.get().isVAppProcess() && !mService.asBinder().pingBinder())) { synchronized (this) { Object remote = getStubInterface(); mService = LocalProxyUtils.genProxy(IAppManager.class, remote); } } return mService; }
private int parseVPid(String stubProcessName) { String prefix = VirtualCore.get().getHostPkg() + ":p"; if (stubProcessName != null && stubProcessName.startsWith(prefix)) { try { return Integer.parseInt(stubProcessName.substring(prefix.length())); } catch (NumberFormatException e) { // ignore } } return -1; }
public static void attach(VActivityManagerService ams, VAppManagerService app) { if (gDefault != null) { throw new IllegalStateException(); } gDefault = new BroadcastSystem(VirtualCore.get().getContext(), ams, app); }
public static <T> T crash(RemoteException e) throws RuntimeException { e.printStackTrace(); if (VirtualCore.get().isVAppProcess()) { Process.killProcess(Process.myPid()); System.exit(0); } throw new DeadServerException(e); }
public boolean dealNotification(int id, Notification notification, String packageName) { if(notification == null)return false; return VirtualCore.get().getHostPkg().equals(packageName) || mNotificationCompat.dealNotification(id, notification, packageName); }
private VPackageInstallerService() { mContext = VirtualCore.get().getContext(); mInstallThread = new HandlerThread("PackageInstaller"); mInstallThread.start(); mInstallHandler = new Handler(mInstallThread.getLooper()); mCallbacks = new Callbacks(mInstallThread.getLooper()); }
public int startActivity(Intent intent, int userId) { if (userId < 0) { return ActivityManagerCompat.START_NOT_CURRENT_USER_ACTIVITY; } ActivityInfo info = VirtualCore.get().resolveActivityInfo(intent, userId); if (info == null) { return ActivityManagerCompat.START_INTENT_NOT_RESOLVED; } return startActivity(intent, info, null, null, null, 0, userId); }
public static File getVirtualPrivateStorageDir(int userId) { String base = String.format(Locale.ENGLISH, "%s/Android/data/%s/%s/%d", Environment.getExternalStorageDirectory(), VirtualCore.get().getHostPkg(), "virtual", userId); File file = new File(base); return ensureCreated(file); }
public void sendBroadcastAsUser(Intent intent, VUserHandle user) { SpecialComponentList.protectIntent(intent); Context context = VirtualCore.get().getContext(); if (user != null) { intent.putExtra("_VA_|_user_id_", user.getIdentifier()); } context.sendBroadcast(intent); }
public static boolean isVisiblePackage(ApplicationInfo info) { return getHostPkg().equals(info.packageName) || ComponentUtils.isSystemApp(info) || VirtualCore.get().isOutsidePackageVisible(info.packageName); }
public static boolean isStubComponent(Intent intent) { return intent != null && intent.getComponent() != null && VirtualCore.get().getHostPkg().equals(intent.getComponent().getPackageName()); }
private static IInterface getInterface() { if (isOreo()) { android.content.ClipboardManager cm = (android.content.ClipboardManager) VirtualCore.get().getContext().getSystemService(Context.CLIPBOARD_SERVICE); return ClipboardManagerOreo.mService.get(cm); } else { return ClipboardManager.getService.call(); } }
public IJobScheduler getRemote() { if (mRemote == null || (!mRemote.asBinder().pingBinder() && !VirtualCore.get().isVAppProcess())) { synchronized (this) { Object remote = getRemoteInterface(); mRemote = LocalProxyUtils.genProxy(IJobScheduler.class, remote); } } return mRemote; }
static void launchEngine() { if (sFlag) { return; } Method[] methods = {NativeMethods.gOpenDexFileNative, NativeMethods.gCameraNativeSetup, NativeMethods.gAudioRecordNativeCheckPermission}; try { nativeLaunchEngine(methods, VirtualCore.get().getHostPkg(), VirtualRuntime.isArt(), Build.VERSION.SDK_INT, NativeMethods.gCameraMethodType); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } sFlag = true; }
@Override public void inject() throws Throwable { super.inject(); if (isOreo()) { android.content.ClipboardManager cm = (android.content.ClipboardManager) VirtualCore.get().getContext().getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManagerOreo.mService.set(cm, getInvocationStub().getProxyInterface()); } else { ClipboardManager.sService.set(getInvocationStub().getProxyInterface()); } }
public IDeviceInfoManager getRemote() { if (mRemote == null || (!mRemote.asBinder().pingBinder() && !VirtualCore.get().isVAppProcess())) { synchronized (this) { Object remote = getRemoteInterface(); mRemote = LocalProxyUtils.genProxy(IDeviceInfoManager.class, remote); } } return mRemote; }
public INotificationManager getService() { if (mRemote == null || (!mRemote.asBinder().pingBinder() && !VirtualCore.get().isVAppProcess())) { synchronized (VNotificationManager.class) { final IBinder pmBinder = ServiceManagerNative.getService(ServiceManagerNative.NOTIFICATION); mRemote = INotificationManager.Stub.asInterface(pmBinder); } } return mRemote; }