private boolean handleUserBroadcast(int vuid, ActivityInfo info, ComponentName component, Intent realIntent, PendingResultData result) { if (component != null && !ComponentUtils.toComponentName(info).equals(component)) { // Verify the component. return false; } String originAction = SpecialComponentList.unprotectAction(realIntent.getAction()); if (originAction != null) { // restore to origin action. realIntent.setAction(originAction); } handleStaticBroadcastAsUser(vuid, info, realIntent, result); return true; }
@Override public void publishService(IBinder token, Intent intent, IBinder service, int userId) { synchronized (this) { ServiceRecord r = (ServiceRecord) token; if (r != null) { ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent); if (boundRecord != null) { boundRecord.binder = service; for (IServiceConnection conn : boundRecord.connections) { ComponentName component = ComponentUtils.toComponentName(r.serviceInfo); connectService(conn, component, boundRecord, false); } } } } }
@Override public VParceledListSlice<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags, int userId) { synchronized (mHistory) { List<ActivityManager.RunningServiceInfo> services = new ArrayList<>(mHistory.size()); for (ServiceRecord r : mHistory) { if (r.process.userId != userId) { continue; } ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo(); info.uid = r.process.vuid; info.pid = r.process.pid; ProcessRecord processRecord = findProcessLocked(r.process.pid); if (processRecord != null) { info.process = processRecord.processName; info.clientPackage = processRecord.info.packageName; } info.activeSince = r.activeSince; info.lastActivityTime = r.lastActivityTime; info.clientCount = r.getClientCount(); info.service = ComponentUtils.toComponentName(r.serviceInfo); info.started = r.startId > 0; services.add(info); } return new VParceledListSlice<>(services); } }
@Override public int stopService(IBinder caller, Intent service, String resolvedType, int userId) { synchronized (this) { ServiceInfo serviceInfo = resolveServiceInfo(service, userId); if (serviceInfo == null) { return 0; } ServiceRecord r = findRecordLocked(userId, serviceInfo); if (r == null) { return 0; } stopServiceCommon(r, ComponentUtils.toComponentName(serviceInfo)); return 1; } }
private void performScheduleReceiver(IVClient client, int vuid, ActivityInfo info, Intent intent, PendingResultData result) { ComponentName componentName = ComponentUtils.toComponentName(info); BroadcastSystem.get().broadcastSent(vuid, info, result); try { client.scheduleReceiver(info.processName, componentName, intent, result); } catch (Throwable e) { if (result != null) { result.finish(); } } }
private Intent startActivityProcess(int userId, ActivityRecord sourceRecord, Intent intent, ActivityInfo info) { intent = new Intent(intent); ProcessRecord targetApp = mService.startProcessIfNeedLocked(info.processName, userId, info.packageName); if (targetApp == null) { return null; } Intent targetIntent = new Intent(); targetIntent.setClassName(VirtualCore.get().getHostPkg(), fetchStubActivity(targetApp.vpid, info)); ComponentName component = intent.getComponent(); if (component == null) { component = ComponentUtils.toComponentName(info); } targetIntent.setType(component.flattenToString()); StubActivityRecord saveInstance = new StubActivityRecord(intent, info, sourceRecord != null ? sourceRecord.component : null, userId); saveInstance.saveToIntent(targetIntent); return targetIntent; }
VLog.e(TAG, "Unable to start new Process for : " + ComponentUtils.toComponentName(serviceInfo)); return null; return ComponentUtils.toComponentName(serviceInfo);
VActivityManager.get().onActivityCreate(ComponentUtils.toComponentName(info), caller, token, info, intent, ComponentUtils.getTaskAffinity(info), taskId, info.launchMode, info.flags); ClassLoader appClassLoader = VClientImpl.get().getClassLoader(info.applicationInfo); intent.setExtrasClassLoader(appClassLoader);
false ); VActivityManager.get().onActivityCreate(ComponentUtils.toComponentName(info), caller, token, info, intent, ComponentUtils.getTaskAffinity(info), taskId, info.launchMode, info.flags); ClassLoader appClassLoader = VClientImpl.get().getClassLoader(info.applicationInfo); intent.setExtrasClassLoader(appClassLoader);
private boolean handleUserBroadcast(int vuid, ActivityInfo info, ComponentName component, Intent realIntent, PendingResultData result) { if (component != null && !ComponentUtils.toComponentName(info).equals(component)) { // Verify the component. return false; } String originAction = SpecialComponentList.unprotectAction(realIntent.getAction()); if (originAction != null) { // restore to origin action. realIntent.setAction(originAction); } handleStaticBroadcastAsUser(vuid, info, realIntent, result); return true; }
private boolean handleUserBroadcast(int vuid, ActivityInfo info, ComponentName component, Intent realIntent, PendingResultData result) { if (component != null && !ComponentUtils.toComponentName(info).equals(component)) { // Verify the component. return false; } String originAction = SpecialComponentList.unprotectAction(realIntent.getAction()); if (originAction != null) { // restore to origin action. realIntent.setAction(originAction); } handleStaticBroadcastAsUser(vuid, info, realIntent, result); return true; }
@Override public void publishService(IBinder token, Intent intent, IBinder service, int userId) { synchronized (this) { ServiceRecord r = (ServiceRecord) token; if (r != null) { ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent); if (boundRecord != null) { boundRecord.binder = service; for (IServiceConnection conn : boundRecord.connections) { ComponentName component = ComponentUtils.toComponentName(r.serviceInfo); connectService(conn, component, boundRecord, false); } } } } }
@Override public void publishService(IBinder token, Intent intent, IBinder service, int userId) { synchronized (this) { ServiceRecord r = (ServiceRecord) token; if (r != null) { ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent); if (boundRecord != null) { boundRecord.binder = service; for (IServiceConnection conn : boundRecord.connections) { ComponentName component = ComponentUtils.toComponentName(r.serviceInfo); connectService(conn, component, boundRecord, false); } } } } }
@Override public int stopService(IBinder caller, Intent service, String resolvedType, int userId) { synchronized (this) { ServiceInfo serviceInfo = resolveServiceInfo(service, userId); if (serviceInfo == null) { return 0; } ServiceRecord r = findRecordLocked(userId, serviceInfo); if (r == null) { return 0; } stopServiceCommon(r, ComponentUtils.toComponentName(serviceInfo)); return 1; } }
@Override public VParceledListSlice<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags, int userId) { synchronized (mHistory) { List<ActivityManager.RunningServiceInfo> services = new ArrayList<>(mHistory.size()); for (ServiceRecord r : mHistory) { if (r.process.userId != userId) { continue; } ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo(); info.uid = r.process.vuid; info.pid = r.process.pid; ProcessRecord processRecord = findProcessLocked(r.process.pid); if (processRecord != null) { info.process = processRecord.processName; info.clientPackage = processRecord.info.packageName; } info.activeSince = r.activeSince; info.lastActivityTime = r.lastActivityTime; info.clientCount = r.getClientCount(); info.service = ComponentUtils.toComponentName(r.serviceInfo); info.started = r.startId > 0; services.add(info); } return new VParceledListSlice<>(services); } }
@Override public int stopService(IBinder caller, Intent service, String resolvedType, int userId) { synchronized (this) { ServiceInfo serviceInfo = resolveServiceInfo(service, userId); if (serviceInfo == null) { return 0; } ServiceRecord r = findRecordLocked(userId, serviceInfo); if (r == null) { return 0; } stopServiceCommon(r, ComponentUtils.toComponentName(serviceInfo)); return 1; } }
private void performScheduleReceiver(IVClient client, int vuid, ActivityInfo info, Intent intent, PendingResultData result) { ComponentName componentName = ComponentUtils.toComponentName(info); BroadcastSystem.get().broadcastSent(vuid, info, result); try { client.scheduleReceiver(info.processName, componentName, intent, result); } catch (Throwable e) { if (result != null) { result.finish(); } } }
private void performScheduleReceiver(IVClient client, int vuid, ActivityInfo info, Intent intent, PendingResultData result) { ComponentName componentName = ComponentUtils.toComponentName(info); BroadcastSystem.get().broadcastSent(vuid, info, result); try { client.scheduleReceiver(info.processName, componentName, intent, result); } catch (Throwable e) { if (result != null) { result.finish(); } } }
private Intent startActivityProcess(int userId, ActivityRecord sourceRecord, Intent intent, ActivityInfo info) { intent = new Intent(intent); ProcessRecord targetApp = mService.startProcessIfNeedLocked(info.processName, userId, info.packageName); if (targetApp == null) { return null; } Intent targetIntent = new Intent(); targetIntent.setClassName(VirtualCore.get().getHostPkg(), fetchStubActivity(targetApp.vpid, info)); ComponentName component = intent.getComponent(); if (component == null) { component = ComponentUtils.toComponentName(info); } targetIntent.setType(component.flattenToString()); StubActivityRecord saveInstance = new StubActivityRecord(intent, info, sourceRecord != null ? sourceRecord.component : null, userId); saveInstance.saveToIntent(targetIntent); return targetIntent; }
private Intent startActivityProcess(int userId, ActivityRecord sourceRecord, Intent intent, ActivityInfo info) { intent = new Intent(intent); ProcessRecord targetApp = mService.startProcessIfNeedLocked(info.processName, userId, info.packageName); if (targetApp == null) { return null; } Intent targetIntent = new Intent(); targetIntent.setClassName(VirtualCore.get().getHostPkg(), fetchStubActivity(targetApp.vpid, info)); ComponentName component = intent.getComponent(); if (component == null) { component = ComponentUtils.toComponentName(info); } targetIntent.setType(component.flattenToString()); StubActivityRecord saveInstance = new StubActivityRecord(intent, info, sourceRecord != null ? sourceRecord.component : null, userId); saveInstance.saveToIntent(targetIntent); return targetIntent; }