private BroadcastSystem(Context context, VActivityManagerService ams, VAppManagerService app) { this.mContext = context; this.mApp = app; this.mAMS = ams; mScheduler = new StaticScheduler(); mTimeoutHandler = new TimeoutHandler(); fuckHuaWeiVerifier(); }
private Intent[] startActivitiesProcess(int userId, Intent[] intents, ActivityInfo[] infos, ActivityRecord resultTo) { Intent[] destIntents = new Intent[intents.length]; for (int i = 0; i < intents.length; i++) { destIntents[i] = startActivityProcess(userId, resultTo, intents[i], infos[i]); } return destIntents; }
private ServiceRecord findRecordLocked(IServiceConnection connection) { synchronized (mHistory) { for (ServiceRecord r : mHistory) { if (r.containConnection(connection)) { return r; } } return null; } }
void addToBoundIntent(Intent intent, IServiceConnection connection) { IntentBindRecord record = peekBinding(intent); if (record == null) { record = new IntentBindRecord(); record.intent = intent; synchronized (bindings) { bindings.add(record); } } record.addConnection(connection); }
@Override public void onActivityCreated(ComponentName component, ComponentName caller, IBinder token, Intent intent, String affinity, int taskId, int launchMode, int flags) { int pid = Binder.getCallingPid(); ProcessRecord targetApp = findProcessLocked(pid); if (targetApp != null) { mMainStack.onActivityCreated(targetApp, component, caller, token, intent, affinity, taskId, launchMode, flags); } }
ComponentName getCallingActivity(int userId, IBinder token) { synchronized (mHistory) { ActivityRecord r = findActivityByToken(userId, token); if (r != null) { return r.caller != null ? r.caller : r.component; } return null; } }
@Override public ComponentName startService(IBinder caller, Intent service, String resolvedType, int userId) { synchronized (this) { return startServiceCommon(service, true, userId); } }
@Override public int initProcess(String packageName, String processName, int userId) { synchronized (this) { ProcessRecord r = startProcessIfNeedLocked(processName, userId, packageName); return r != null ? r.vpid : -1; } }
public boolean containConnection(IServiceConnection connection) { for (IntentBindRecord record : bindings) { if (record.containConnection(connection)) { return true; } } return false; }
@Override public boolean isAppPid(int pid) { synchronized (mPidsSelfLocked) { return findProcessLocked(pid) != null; } }
/** * Should guard by {@link VActivityManagerService#mProcessNames} * * @param uid vuid */ public ProcessRecord findProcessLocked(String processName, int uid) { return mProcessNames.get(processName, uid); }
public static void init(Context context) { if (sInstance == null) { sInstance = new AttributeCache(context); } }
@Override public void unbindFinished(IBinder token, Intent service, boolean doRebind, int userId) { synchronized (this) { ServiceRecord r = (ServiceRecord) token; if (r != null) { ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(service); if (boundRecord != null) { boundRecord.doRebind = doRebind; } } } }
@Override public String getPackageForIntentSender(IBinder binder) { PendingIntentData data = mPendingIntents.getPendingIntent(binder); if (data != null) { return data.creator; } return null; }
@Override public int startActivity(Intent intent, ActivityInfo info, IBinder resultTo, Bundle options, String resultWho, int requestCode, int userId) { synchronized (this) { return mMainStack.startActivityLocked(userId, intent, info, resultTo, options, resultWho, requestCode); } }
@Override public boolean onActivityDestroyed(int userId, IBinder token) { ActivityRecord r = mMainStack.onActivityDestroyed(userId, token); return r != null; }
@Override public boolean stopServiceToken(ComponentName className, IBinder token, int startId, int userId) { synchronized (this) { ServiceRecord r = (ServiceRecord) token; if (r != null && (r.startId == startId || startId == -1)) { stopServiceCommon(r, className); return true; } return false; } }
@Override public String getPackageForToken(int userId, IBinder token) { return mMainStack.getPackageForToken(userId, token); }
@Override public boolean isAppProcess(String processName) { return parseVPid(processName) != -1; }
ComponentName getActivityClassForToken(int userId, IBinder token) { synchronized (mHistory) { ActivityRecord r = findActivityByToken(userId, token); if (r != null) { return r.component; } return null; } }