private boolean isAccountExist(int userId, Account account, String providerName) { synchronized (mAppSyncAdapterInfos) { SyncAdapterInfo info = mAppSyncAdapterInfos.get(account.type + "/" + providerName); return info != null && VAppManagerService.get().isAppInstalled(info.serviceInfo.packageName); } }
@Override public void processRestarted(String packageName, String processName, int userId) { int callingPid = getCallingPid(); int appId = VAppManagerService.get().getAppId(packageName); int uid = VUserHandle.getUid(userId, appId); synchronized (this) { ProcessRecord app = findProcessLocked(callingPid); if (app == null) { ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE; String stubProcessName = getProcessName(callingPid); int vpid = parseVPid(stubProcessName); if (vpid != -1) { performStartProcessLocked(uid, vpid, appInfo, processName); } } } }
@Override public void onPersistenceFileDamage() { getPersistenceFile().delete(); VAppManagerService.get().restoreFactoryState(); } }
@Override public void processRestarted(String packageName, String processName, int userId) { int callingPid = getCallingPid(); int appId = VAppManagerService.get().getAppId(packageName); int uid = VUserHandle.getUid(userId, appId); synchronized (this) { ProcessRecord app = findProcessLocked(callingPid); if (app == null) { ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE; String stubProcessName = getProcessName(callingPid); int vpid = parseVPid(stubProcessName); if (vpid != -1) { performStartProcessLocked(uid, vpid, appInfo, processName); } } } }
@Override public void uninstall(String packageName, String callerPackageName, int flags, IntentSender statusReceiver, int userId) throws RemoteException { boolean success = VAppManagerService.get().uninstallPackage(packageName); if (statusReceiver != null) { final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, success ? PackageInstaller.STATUS_SUCCESS : PackageInstaller.STATUS_FAILURE); fillIn.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, PackageHelper.deleteStatusToString(success)); fillIn.putExtra("android.content.pm.extra.LEGACY_STATUS", success ? 1 : -1); try { statusReceiver.sendIntent(mContext, 0, fillIn, null, null); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } } }
@Override public void processRestarted(String packageName, String processName, int userId) { int callingPid = getCallingPid(); int appId = VAppManagerService.get().getAppId(packageName); int uid = VUserHandle.getUid(userId, appId); synchronized (this) { ProcessRecord app = findProcessLocked(callingPid); if (app == null) { ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE; String stubProcessName = getProcessName(callingPid); int vpid = parseVPid(stubProcessName); if (vpid != -1) { performStartProcessLocked(uid, vpid, appInfo, processName); } } } }
@Override public boolean onCreate() { Context context = getContext(); DaemonService.startup(context); if (!VirtualCore.get().isStartup()) { return true; } VPackageManagerService.systemReady(); addService(ServiceManagerNative.PACKAGE, VPackageManagerService.get()); VActivityManagerService.systemReady(context); addService(ServiceManagerNative.ACTIVITY, VActivityManagerService.get()); addService(ServiceManagerNative.USER, VUserManagerService.get()); VAppManagerService.systemReady(); addService(ServiceManagerNative.APP, VAppManagerService.get()); BroadcastSystem.attach(VActivityManagerService.get(), VAppManagerService.get()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addService(ServiceManagerNative.JOB, VJobSchedulerService.get()); } VNotificationManagerService.systemReady(context); addService(ServiceManagerNative.NOTIFICATION, VNotificationManagerService.get()); VAppManagerService.get().scanApps(); VAccountManagerService.systemReady(); addService(ServiceManagerNative.ACCOUNT, VAccountManagerService.get()); addService(ServiceManagerNative.VS, VirtualStorageService.get()); addService(ServiceManagerNative.DEVICE, VDeviceManagerService.get()); addService(ServiceManagerNative.VIRTUAL_LOC, VirtualLocationService.get()); return true; }
ProcessRecord startProcessIfNeedLocked(String processName, int userId, String packageName) { if (VActivityManagerService.get().getFreeStubCount() < 3) { // run GC killAllApps(); } PackageSetting ps = PackageCacheManager.getSetting(packageName); ApplicationInfo info = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); if (ps == null || info == null) { return null; } if (!ps.isLaunched(userId)) { sendFirstLaunchBroadcast(ps, userId); ps.setLaunched(userId, true); VAppManagerService.get().savePersistenceData(); } int uid = VUserHandle.getUid(userId, ps.appId); ProcessRecord app = mProcessNames.get(processName, uid); if (app != null && app.client.asBinder().pingBinder()) { return app; } int vpid = queryFreeStubProcessLocked(); if (vpid == -1) { return null; } app = performStartProcessLocked(uid, vpid, info, processName); if (app != null) { app.pkgList.add(info.packageName); } return app; }
private boolean isAccountExist(int userId, Account account, String providerName) { synchronized (mAppSyncAdapterInfos) { SyncAdapterInfo info = mAppSyncAdapterInfos.get(account.type + "/" + providerName); return info != null && VAppManagerService.get().isAppInstalled(info.serviceInfo.packageName); } }
private boolean isAccountExist(int userId, Account account, String providerName) { synchronized (mAppSyncAdapterInfos) { SyncAdapterInfo info = mAppSyncAdapterInfos.get(account.type + "/" + providerName); return info != null && VAppManagerService.get().isAppInstalled(info.serviceInfo.packageName); } }
@Override public void onPersistenceFileDamage() { getPersistenceFile().delete(); VAppManagerService.get().restoreFactoryState(); } }
@Override public void onPersistenceFileDamage() { getPersistenceFile().delete(); VAppManagerService.get().restoreFactoryState(); } }
@Override public void uninstall(String packageName, String callerPackageName, int flags, IntentSender statusReceiver, int userId) throws RemoteException { boolean success = VAppManagerService.get().uninstallPackage(packageName); if (statusReceiver != null) { final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, success ? PackageInstaller.STATUS_SUCCESS : PackageInstaller.STATUS_FAILURE); fillIn.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, PackageHelper.deleteStatusToString(success)); fillIn.putExtra("android.content.pm.extra.LEGACY_STATUS", success ? 1 : -1); try { statusReceiver.sendIntent(mContext, 0, fillIn, null, null); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } } }
@Override public void uninstall(String packageName, String callerPackageName, int flags, IntentSender statusReceiver, int userId) throws RemoteException { boolean success = VAppManagerService.get().uninstallPackage(packageName); if (statusReceiver != null) { final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, success ? PackageInstaller.STATUS_SUCCESS : PackageInstaller.STATUS_FAILURE); fillIn.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, PackageHelper.deleteStatusToString(success)); fillIn.putExtra("android.content.pm.extra.LEGACY_STATUS", success ? 1 : -1); try { statusReceiver.sendIntent(mContext, 0, fillIn, null, null); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } } }
@Override public boolean onCreate() { Context context = getContext(); DaemonService.startup(context); if (!VirtualCore.get().isStartup()) { return true; } VPackageManagerService.systemReady(); addService(ServiceManagerNative.PACKAGE, VPackageManagerService.get()); VActivityManagerService.systemReady(context); addService(ServiceManagerNative.ACTIVITY, VActivityManagerService.get()); addService(ServiceManagerNative.USER, VUserManagerService.get()); VAppManagerService.systemReady(); addService(ServiceManagerNative.APP, VAppManagerService.get()); BroadcastSystem.attach(VActivityManagerService.get(), VAppManagerService.get()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addService(ServiceManagerNative.JOB, VJobSchedulerService.get()); } VNotificationManagerService.systemReady(context); addService(ServiceManagerNative.NOTIFICATION, VNotificationManagerService.get()); VAppManagerService.get().scanApps(); VAccountManagerService.systemReady(); addService(ServiceManagerNative.ACCOUNT, VAccountManagerService.get()); addService(ServiceManagerNative.VS, VirtualStorageService.get()); addService(ServiceManagerNative.DEVICE, VDeviceManagerService.get()); addService(ServiceManagerNative.VIRTUAL_LOC, VirtualLocationService.get()); return true; }
@Override public boolean onCreate() { Context context = getContext(); DaemonService.startup(context); if (!VirtualCore.get().isStartup()) { return true; } VPackageManagerService.systemReady(); IPCBus.register(IPackageManager.class, VPackageManagerService.get()); VActivityManagerService.systemReady(context); IPCBus.register(IActivityManager.class, VActivityManagerService.get()); IPCBus.register(IUserManager.class, VUserManagerService.get()); VAppManagerService.systemReady(); IPCBus.register(IAppManager.class, VAppManagerService.get()); BroadcastSystem.attach(VActivityManagerService.get(), VAppManagerService.get()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { IPCBus.register(IJobScheduler.class, VJobSchedulerService.get()); } VNotificationManagerService.systemReady(context); IPCBus.register(INotificationManager.class, VNotificationManagerService.get()); VAppManagerService.get().scanApps(); VAccountManagerService.systemReady(); IPCBus.register(IAccountManager.class, VAccountManagerService.get()); IPCBus.register(IVirtualStorageService.class, VirtualStorageService.get()); IPCBus.register(IDeviceInfoManager.class, VDeviceManagerService.get()); IPCBus.register(IVirtualLocationManager.class, VirtualLocationService.get()); return true; }
ProcessRecord startProcessIfNeedLocked(String processName, int userId, String packageName) { if (VActivityManagerService.get().getFreeStubCount() < 3) { // run GC killAllApps(); } PackageSetting ps = PackageCacheManager.getSetting(packageName); ApplicationInfo info = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); if (ps == null || info == null) { return null; } if (!ps.isLaunched(userId)) { sendFirstLaunchBroadcast(ps, userId); ps.setLaunched(userId, true); VAppManagerService.get().savePersistenceData(); } int uid = VUserHandle.getUid(userId, ps.appId); ProcessRecord app = mProcessNames.get(processName, uid); if (app != null && app.client.asBinder().pingBinder()) { return app; } int vpid = queryFreeStubProcessLocked(); if (vpid == -1) { return null; } app = performStartProcessLocked(uid, vpid, info, processName); if (app != null) { app.pkgList.add(info.packageName); } return app; }
ProcessRecord startProcessIfNeedLocked(String processName, int userId, String packageName) { if (VActivityManagerService.get().getFreeStubCount() < 3) { // run GC killAllApps(); } PackageSetting ps = PackageCacheManager.getSetting(packageName); ApplicationInfo info = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId); if (ps == null || info == null) { return null; } if (!ps.isLaunched(userId)) { sendFirstLaunchBroadcast(ps, userId); ps.setLaunched(userId, true); VAppManagerService.get().savePersistenceData(); } int uid = VUserHandle.getUid(userId, ps.appId); ProcessRecord app = mProcessNames.get(processName, uid); if (app != null && app.client.asBinder().isBinderAlive()) { return app; } int vpid = queryFreeStubProcessLocked(); if (vpid == -1) { return null; } app = performStartProcessLocked(uid, vpid, info, processName); if (app != null) { app.pkgList.add(info.packageName); } return app; }