@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); } }
ActivityStack(VActivityManagerService mService) { this.mService = mService; mAM = (ActivityManager) VirtualCore.get().getContext().getSystemService(Context.ACTIVITY_SERVICE); }
public Context getContext() { return VirtualCore.get().getContext(); }
private static Context getContext() { return VirtualCore.get().getContext(); }
@SuppressLint("SdCardPath") private HashSet<String> getMountPoints() { HashSet<String> mountPoints = new HashSet<>(3); mountPoints.add("/mnt/sdcard/"); mountPoints.add("/sdcard/"); String[] points = StorageManagerCompat.getAllPoints(VirtualCore.get().getContext()); if (points != null) { Collections.addAll(mountPoints, points); } return mountPoints; }
private VPackageInstallerService() { mContext = VirtualCore.get().getContext(); mInstallThread = new HandlerThread("PackageInstaller"); mInstallThread.start(); mInstallHandler = new Handler(mInstallThread.getLooper()); mCallbacks = new Callbacks(mInstallThread.getLooper()); }
public void sendBroadcast(Intent intent, int userId) { Intent newIntent = ComponentUtils.redirectBroadcastIntent(intent, userId); if (newIntent != null) { VirtualCore.get().getContext().sendBroadcast(newIntent); } }
public InputMethodManagerStub() { super( InputMethodManager.mService.get( VirtualCore.get().getContext().getSystemService(Context.INPUT_METHOD_SERVICE)), Context.INPUT_METHOD_SERVICE); }
public static void attach(VActivityManagerService ams, VAppManagerService app) { if (gDefault != null) { throw new IllegalStateException(); } gDefault = new BroadcastSystem(VirtualCore.get().getContext(), ams, app); }
private static IInterface getInterface() { LauncherApps cm = (LauncherApps) VirtualCore.get().getContext().getSystemService(Context.LAUNCHER_APPS_SERVICE); return mirror.android.content.pm.LauncherApps.mService.get(cm); }
public boolean bindServiceAsUser(Intent service, ServiceConnection connection, int flags, VUserHandle user) { service = new Intent(service); if (user != null) { service.putExtra("_VA_|_user_id_", user.getIdentifier()); } return VirtualCore.get().getContext().bindService(service, connection, flags); }
public void sendBroadcastAsUser(Intent intent, VUserHandle user, String permission) { SpecialComponentList.protectIntent(intent); Context context = VirtualCore.get().getContext(); if (user != null) { intent.putExtra("_VA_|_user_id_", user.getIdentifier()); } // TODO: checkPermission context.sendBroadcast(intent); }
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 void systemReady() { VPackageManagerService instance = new VPackageManagerService(); new VUserManagerService(VirtualCore.get().getContext(), instance, new char[0], instance.mPackages); gService.set(instance); }
public void sendOrderedBroadcastAsUser(Intent intent, VUserHandle user, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { Context context = VirtualCore.get().getContext(); if (user != null) { intent.putExtra("_VA_|_user_id_", user.getIdentifier()); } // TODO: checkPermission context.sendOrderedBroadcast(intent, null/* permission */, resultReceiver, scheduler, initialCode, initialData, initialExtras); }
private Context createPackageContext(String packageName) { try { Context hostContext = VirtualCore.get().getContext(); return hostContext.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); VirtualRuntime.crash(new RemoteException()); } throw new RuntimeException(); }
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 static IServiceConnection removeDelegate(Context context, ServiceConnection conn) { IServiceConnection connection = null; try{ Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext()); connection = LoadedApk.forgetServiceDispatcher.call(loadApk, context, conn); }catch (Exception e){ Log.e("ConnectionDelegate", "forgetServiceDispatcher", e); } if(connection == null){ return null; } return ServiceConnectionDelegate.removeDelegate(connection); }
@Override public void inject() throws Throwable { super.inject(); LauncherApps cm = (LauncherApps) VirtualCore.get().getContext().getSystemService(Context.LAUNCHER_APPS_SERVICE); mirror.android.content.pm.LauncherApps.mService.set(cm, getInvocationStub().getProxyInterface()); }
@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()); } }