diff options
Diffstat (limited to 'com/android/server/am/ActivityStackSupervisor.java')
-rw-r--r-- | com/android/server/am/ActivityStackSupervisor.java | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/com/android/server/am/ActivityStackSupervisor.java b/com/android/server/am/ActivityStackSupervisor.java index d5dfdcf0..cbf30bdd 100644 --- a/com/android/server/am/ActivityStackSupervisor.java +++ b/com/android/server/am/ActivityStackSupervisor.java @@ -667,6 +667,14 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return mFocusedStack; } + boolean isFocusable(ConfigurationContainer container, boolean alwaysFocusable) { + if (container.inSplitScreenPrimaryWindowingMode() && mIsDockMinimized) { + return false; + } + + return container.getWindowConfiguration().canReceiveKeys() || alwaysFocusable; + } + ActivityStack getLastStack() { return mLastFocusedStack; } @@ -1264,10 +1272,11 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } ResolveInfo resolveIntent(Intent intent, String resolvedType, int userId) { - return resolveIntent(intent, resolvedType, userId, 0); + return resolveIntent(intent, resolvedType, userId, 0, Binder.getCallingUid()); } - ResolveInfo resolveIntent(Intent intent, String resolvedType, int userId, int flags) { + ResolveInfo resolveIntent(Intent intent, String resolvedType, int userId, int flags, + int filterCallingUid) { synchronized (mService) { try { Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "resolveIntent"); @@ -1278,7 +1287,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D modifiedFlags |= PackageManager.MATCH_INSTANT; } return mService.getPackageManagerInternalLocked().resolveIntent( - intent, resolvedType, modifiedFlags, userId, true); + intent, resolvedType, modifiedFlags, userId, true, filterCallingUid); } finally { Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); @@ -1287,8 +1296,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } ActivityInfo resolveActivity(Intent intent, String resolvedType, int startFlags, - ProfilerInfo profilerInfo, int userId) { - final ResolveInfo rInfo = resolveIntent(intent, resolvedType, userId); + ProfilerInfo profilerInfo, int userId, int filterCallingUid) { + final ResolveInfo rInfo = resolveIntent(intent, resolvedType, userId, 0, filterCallingUid); return resolveActivity(intent, rInfo, startFlags, profilerInfo); } @@ -1371,12 +1380,13 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mService.updateLruProcessLocked(app, true, null); mService.updateOomAdjLocked(); + final LockTaskController lockTaskController = mService.getLockTaskController(); if (task.mLockTaskAuth == LOCK_TASK_AUTH_LAUNCHABLE || task.mLockTaskAuth == LOCK_TASK_AUTH_LAUNCHABLE_PRIV || (task.mLockTaskAuth == LOCK_TASK_AUTH_WHITELISTED - && mService.mLockTaskController.getLockTaskModeState() - == LOCK_TASK_MODE_LOCKED)) { - mService.mLockTaskController.startLockTaskMode(task, false, 0 /* blank UID */); + && lockTaskController.getLockTaskModeState() + == LOCK_TASK_MODE_LOCKED)) { + lockTaskController.startLockTaskMode(task, false, 0 /* blank UID */); } try { @@ -1579,7 +1589,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // to run in multiple processes, because this is actually // part of the framework so doesn't make sense to track as a // separate apk in the process. - app.addPackage(r.info.packageName, r.info.applicationInfo.versionCode, + app.addPackage(r.info.packageName, r.info.applicationInfo.longVersionCode, mService.mProcessStats); } realStartActivityLocked(r, app, andResume, checkConfig); @@ -2126,15 +2136,22 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } - TaskRecord finishTopRunningActivityLocked(ProcessRecord app, String reason) { + /** + * Finish the topmost activities in all stacks that belong to the crashed app. + * @param app The app that crashed. + * @param reason Reason to perform this action. + * @return The task that was finished in this stack, {@code null} if haven't found any. + */ + TaskRecord finishTopCrashedActivitiesLocked(ProcessRecord app, String reason) { TaskRecord finishedTask = null; ActivityStack focusedStack = getFocusedStack(); for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) { final ActivityDisplay display = mActivityDisplays.valueAt(displayNdx); - final int numStacks = display.getChildCount(); - for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) { + // It is possible that request to finish activity might also remove its task and stack, + // so we need to be careful with indexes in the loop and check child count every time. + for (int stackNdx = 0; stackNdx < display.getChildCount(); ++stackNdx) { final ActivityStack stack = display.getChildAt(stackNdx); - TaskRecord t = stack.finishTopRunningActivityLocked(app, reason); + final TaskRecord t = stack.finishTopCrashedActivityLocked(app, reason); if (stack == focusedStack || finishedTask == null) { finishedTask = t; } @@ -2892,7 +2909,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D if (tr != null) { tr.removeTaskActivitiesLocked(pauseImmediately, reason); cleanUpRemovedTaskLocked(tr, killProcess, removeFromRecents); - mService.mLockTaskController.clearLockedTask(tr); + mService.getLockTaskController().clearLockedTask(tr); if (tr.isPersistable) { mService.notifyTaskPersisterLocked(null, true); } @@ -3806,7 +3823,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D pw.print(mRecentTasks.isRecentsComponentHomeActivity(mCurrentUser)); getKeyguardController().dump(pw, prefix); - mService.mLockTaskController.dump(pw, prefix); + mService.getLockTaskController().dump(pw, prefix); } public void writeToProto(ProtoOutputStream proto, long fieldId) { |