Loading services/core/java/com/android/server/wm/ActivityStack.java +3 −3 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import static android.app.WindowConfiguration.windowingModeToString; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING; import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD; import static android.view.Display.INVALID_DISPLAY; Loading Loading @@ -4342,7 +4342,7 @@ class ActivityStack extends ConfigurationContainer { return; } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "stack.resize_" + mStackId); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "stack.resize_" + mStackId); mService.deferWindowLayout(); try { // Update override configurations of all tasks in the stack. Loading @@ -4368,7 +4368,7 @@ class ActivityStack extends ConfigurationContainer { } } finally { mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +7 −7 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import static android.graphics.Rect.copyOrNull; import static android.os.PowerManager.PARTIAL_WAKE_LOCK; import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.Display.TYPE_VIRTUAL; Loading Loading @@ -690,7 +690,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { ResolveInfo resolveIntent(Intent intent, String resolvedType, int userId, int flags, int filterCallingUid) { try { Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "resolveIntent"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resolveIntent"); int modifiedFlags = flags | PackageManager.MATCH_DEFAULT_ONLY | ActivityManagerService.STOCK_PM_FLAGS; if (intent.isWebIntent() Loading @@ -711,7 +711,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { Binder.restoreCallingIdentity(token); } } finally { Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -1629,7 +1629,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { mPendingTempOtherTaskInsetBounds = copyOrNull(tempOtherTaskInsetBounds); } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeDockedStack"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resizeDockedStack"); mService.deferWindowLayout(); try { // Don't allow re-entry while resizing. E.g. due to docked stack detaching. Loading Loading @@ -1695,7 +1695,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } finally { mAllowDockedStackResize = true; mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading @@ -1717,7 +1717,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return; } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizePinnedStack"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resizePinnedStack"); mService.deferWindowLayout(); try { Rect insetBounds = null; Loading @@ -1739,7 +1739,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { !DEFER_RESUME); } finally { mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading services/core/java/com/android/server/wm/ActivityStarter.java +52 −38 Original line number Diff line number Diff line Loading @@ -770,13 +770,13 @@ class ActivityStarter { boolean restrictedBgActivity = false; if (!abort) { try { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "shouldAbortBackgroundActivityStart"); restrictedBgActivity = shouldAbortBackgroundActivityStart(callingUid, callingPid, callingPackage, realCallingUid, realCallingPid, callerApp, originatingPendingIntent, allowBackgroundActivityStart, intent); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -1401,29 +1401,48 @@ class ActivityStarter { final ActivityStack startedActivityStack; try { mService.deferWindowLayout(); result = startActivityUnchecked(r, sourceRecord, voiceSession, voiceInteractor, Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startActivityInner"); result = startActivityInner(r, sourceRecord, voiceSession, voiceInteractor, startFlags, doResume, options, inTask, outActivity, restrictedBgActivity); } finally { final ActivityStack currentStack = r.getActivityStack(); startedActivityStack = currentStack != null ? currentStack : mTargetStack; Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); startedActivityStack = handleStartResult(r, result); mService.continueWindowLayout(); } postStartActivityProcessing(r, result, startedActivityStack); return result; } /** * If the start result is success, ensure that the configuration of the started activity matches * the current display. Otherwise clean up unassociated containers to avoid leakage. * * @return the stack where the successful started activity resides. */ private @Nullable ActivityStack handleStartResult(@NonNull ActivityRecord started, int result) { final ActivityStack currentStack = started.getActivityStack(); ActivityStack startedActivityStack = currentStack != null ? currentStack : mTargetStack; if (ActivityManager.isStartResultSuccessful(result)) { if (startedActivityStack != null) { // If there is no state change (e.g. a resumed activity is reparented to // top of another display) to trigger a visibility/configuration checking, // we have to update the configuration for changing to different display. final ActivityRecord currentTop = startedActivityStack.topRunningActivityLocked(); // If there is no state change (e.g. a resumed activity is reparented to top of // another display) to trigger a visibility/configuration checking, we have to // update the configuration for changing to different display. final ActivityRecord currentTop = startedActivityStack.topRunningActivityLocked(); if (currentTop != null && currentTop.shouldUpdateConfigForDisplayChanged()) { mRootActivityContainer.ensureVisibilityAndConfig( currentTop, currentTop.getDisplayId(), true /* markFrozenIfConfigChanged */, false /* deferResume */); } } } else { // If we are not able to proceed, disassociate the activity from the task. // Leaving an activity in an incomplete state can lead to issues, such as // performing operations without a window container. return startedActivityStack; } // If we are not able to proceed, disassociate the activity from the task. Leaving an // activity in an incomplete state can lead to issues, such as performing operations // without a window container. final ActivityStack stack = mStartActivity.getActivityStack(); if (stack != null) { mStartActivity.finishIfPossible("startActivity", true /* oomAdj */); Loading @@ -1434,14 +1453,9 @@ class ActivityStarter { && startedActivityStack.numActivities() == 0 && !startedActivityStack.isActivityTypeHome()) { startedActivityStack.remove(); startedActivityStack = null; } } mService.continueWindowLayout(); } postStartActivityProcessing(r, result, startedActivityStack); return result; return startedActivityStack; } /** Loading Loading @@ -1469,7 +1483,7 @@ class ActivityStarter { } // Note: This method should only be called from {@link startActivity}. private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord, private int startActivityInner(final ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, ActivityRecord[] outActivity, boolean restrictedBgActivity) { Loading Loading @@ -1592,7 +1606,7 @@ class ActivityStarter { // accordingly. if (mTargetStack.isFocusable() && !mRootActivityContainer.isTopDisplayFocusedStack(mTargetStack)) { mTargetStack.moveToFront("startActivityUnchecked"); mTargetStack.moveToFront("startActivityInner"); } mRootActivityContainer.resumeFocusedStacksTopActivities( mTargetStack, mStartActivity, mOptions); Loading Loading @@ -1873,7 +1887,7 @@ class ActivityStarter { mTargetStack = computeStackFocus(mSourceRecord, false /* newTask */, mLaunchFlags, mOptions); mTargetStack.addTask(targetTask, !mLaunchTaskBehind /* toTop */, "startActivityUnchecked"); !mLaunchTaskBehind /* toTop */, "complyActivityFlags"); } } } else if ((mLaunchFlags & FLAG_ACTIVITY_CLEAR_TOP) == 0 && !mAddingToTask Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +24 −7 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL; import static android.os.FactoryTest.FACTORY_TEST_OFF; import static android.os.Process.FIRST_APPLICATION_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT; import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES; import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RTL; Loading Loading @@ -1606,6 +1606,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } final long origId = Binder.clearCallingIdentity(); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "finishActivity"); try { boolean res; final boolean finishWithRootActivity = Loading Loading @@ -1633,6 +1634,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } return res; } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading Loading @@ -1667,6 +1669,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { try { WindowProcessController proc = null; synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityIdle"); ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack == null) { return; Loading @@ -1681,6 +1684,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading @@ -1707,10 +1711,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public final void activityPaused(IBinder token) { final long origId = Binder.clearCallingIdentity(); synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityPaused"); ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack != null) { stack.activityPausedLocked(token, false); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } Binder.restoreCallingIdentity(origId); } Loading @@ -1731,6 +1737,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { int restartingUid = 0; final ActivityRecord r; synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityStopped"); r = ActivityRecord.isInStackLocked(token); if (r != null) { if (r.attachedToProcess() Loading @@ -1742,6 +1749,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } r.activityStoppedLocked(icicle, persistentState, description); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } if (restartingName != null) { Loading @@ -1763,12 +1771,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "ACTIVITY DESTROYED: " + token); synchronized (mGlobalLock) { final long origId = Binder.clearCallingIdentity(); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityDestroyed"); try { final ActivityRecord activity = ActivityRecord.forTokenLocked(token); if (activity != null) { activity.destroyed("activityDestroyed"); } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading Loading @@ -5506,8 +5516,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { void startProcessAsync(ActivityRecord activity, boolean knownToBeDead, boolean isTop, String hostingType) { try { if (Trace.isTagEnabled(TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dispatchingStartProcess:" if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "dispatchingStartProcess:" + activity.processName); } // Post message to start process to avoid possible deadlock of calling into AMS with the Loading @@ -5517,7 +5527,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { isTop, hostingType, activity.intent.getComponent()); mH.sendMessage(m); } finally { Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -5670,11 +5680,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { private void updateResumedAppTrace(@Nullable ActivityRecord resumed) { if (mTracedResumedActivity != null) { Trace.asyncTraceEnd(TRACE_TAG_ACTIVITY_MANAGER, Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, constructResumedTraceName(mTracedResumedActivity.packageName), 0); } if (resumed != null) { Trace.asyncTraceBegin(TRACE_TAG_ACTIVITY_MANAGER, Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, constructResumedTraceName(resumed.packageName), 0); } mTracedResumedActivity = resumed; Loading Loading @@ -6773,7 +6783,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean attachApplication(WindowProcessController wpc) throws RemoteException { synchronized (mGlobalLockWithoutBoost) { if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "attachApplication:" + wpc.mName); } try { return mRootActivityContainer.attachApplication(wpc); } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } } Loading services/core/java/com/android/server/wm/AppWindowToken.java +4 −2 Original line number Diff line number Diff line Loading @@ -2283,7 +2283,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } private final Runnable mAddStartingWindow = new Runnable() { private class AddStartingWindow implements Runnable { @Override public void run() { Loading Loading @@ -2343,7 +2343,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree AppWindowToken.this); } } }; } private final AddStartingWindow mAddStartingWindow = new AddStartingWindow(); private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents, Loading Loading
services/core/java/com/android/server/wm/ActivityStack.java +3 −3 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import static android.app.WindowConfiguration.windowingModeToString; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING; import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD; import static android.view.Display.INVALID_DISPLAY; Loading Loading @@ -4342,7 +4342,7 @@ class ActivityStack extends ConfigurationContainer { return; } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "stack.resize_" + mStackId); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "stack.resize_" + mStackId); mService.deferWindowLayout(); try { // Update override configurations of all tasks in the stack. Loading @@ -4368,7 +4368,7 @@ class ActivityStack extends ConfigurationContainer { } } finally { mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +7 −7 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import static android.graphics.Rect.copyOrNull; import static android.os.PowerManager.PARTIAL_WAKE_LOCK; import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.Display.TYPE_VIRTUAL; Loading Loading @@ -690,7 +690,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { ResolveInfo resolveIntent(Intent intent, String resolvedType, int userId, int flags, int filterCallingUid) { try { Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "resolveIntent"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resolveIntent"); int modifiedFlags = flags | PackageManager.MATCH_DEFAULT_ONLY | ActivityManagerService.STOCK_PM_FLAGS; if (intent.isWebIntent() Loading @@ -711,7 +711,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { Binder.restoreCallingIdentity(token); } } finally { Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -1629,7 +1629,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { mPendingTempOtherTaskInsetBounds = copyOrNull(tempOtherTaskInsetBounds); } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeDockedStack"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resizeDockedStack"); mService.deferWindowLayout(); try { // Don't allow re-entry while resizing. E.g. due to docked stack detaching. Loading Loading @@ -1695,7 +1695,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } finally { mAllowDockedStackResize = true; mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading @@ -1717,7 +1717,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return; } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizePinnedStack"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "resizePinnedStack"); mService.deferWindowLayout(); try { Rect insetBounds = null; Loading @@ -1739,7 +1739,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { !DEFER_RESUME); } finally { mService.continueWindowLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading
services/core/java/com/android/server/wm/ActivityStarter.java +52 −38 Original line number Diff line number Diff line Loading @@ -770,13 +770,13 @@ class ActivityStarter { boolean restrictedBgActivity = false; if (!abort) { try { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "shouldAbortBackgroundActivityStart"); restrictedBgActivity = shouldAbortBackgroundActivityStart(callingUid, callingPid, callingPackage, realCallingUid, realCallingPid, callerApp, originatingPendingIntent, allowBackgroundActivityStart, intent); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -1401,29 +1401,48 @@ class ActivityStarter { final ActivityStack startedActivityStack; try { mService.deferWindowLayout(); result = startActivityUnchecked(r, sourceRecord, voiceSession, voiceInteractor, Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startActivityInner"); result = startActivityInner(r, sourceRecord, voiceSession, voiceInteractor, startFlags, doResume, options, inTask, outActivity, restrictedBgActivity); } finally { final ActivityStack currentStack = r.getActivityStack(); startedActivityStack = currentStack != null ? currentStack : mTargetStack; Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); startedActivityStack = handleStartResult(r, result); mService.continueWindowLayout(); } postStartActivityProcessing(r, result, startedActivityStack); return result; } /** * If the start result is success, ensure that the configuration of the started activity matches * the current display. Otherwise clean up unassociated containers to avoid leakage. * * @return the stack where the successful started activity resides. */ private @Nullable ActivityStack handleStartResult(@NonNull ActivityRecord started, int result) { final ActivityStack currentStack = started.getActivityStack(); ActivityStack startedActivityStack = currentStack != null ? currentStack : mTargetStack; if (ActivityManager.isStartResultSuccessful(result)) { if (startedActivityStack != null) { // If there is no state change (e.g. a resumed activity is reparented to // top of another display) to trigger a visibility/configuration checking, // we have to update the configuration for changing to different display. final ActivityRecord currentTop = startedActivityStack.topRunningActivityLocked(); // If there is no state change (e.g. a resumed activity is reparented to top of // another display) to trigger a visibility/configuration checking, we have to // update the configuration for changing to different display. final ActivityRecord currentTop = startedActivityStack.topRunningActivityLocked(); if (currentTop != null && currentTop.shouldUpdateConfigForDisplayChanged()) { mRootActivityContainer.ensureVisibilityAndConfig( currentTop, currentTop.getDisplayId(), true /* markFrozenIfConfigChanged */, false /* deferResume */); } } } else { // If we are not able to proceed, disassociate the activity from the task. // Leaving an activity in an incomplete state can lead to issues, such as // performing operations without a window container. return startedActivityStack; } // If we are not able to proceed, disassociate the activity from the task. Leaving an // activity in an incomplete state can lead to issues, such as performing operations // without a window container. final ActivityStack stack = mStartActivity.getActivityStack(); if (stack != null) { mStartActivity.finishIfPossible("startActivity", true /* oomAdj */); Loading @@ -1434,14 +1453,9 @@ class ActivityStarter { && startedActivityStack.numActivities() == 0 && !startedActivityStack.isActivityTypeHome()) { startedActivityStack.remove(); startedActivityStack = null; } } mService.continueWindowLayout(); } postStartActivityProcessing(r, result, startedActivityStack); return result; return startedActivityStack; } /** Loading Loading @@ -1469,7 +1483,7 @@ class ActivityStarter { } // Note: This method should only be called from {@link startActivity}. private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord, private int startActivityInner(final ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, ActivityRecord[] outActivity, boolean restrictedBgActivity) { Loading Loading @@ -1592,7 +1606,7 @@ class ActivityStarter { // accordingly. if (mTargetStack.isFocusable() && !mRootActivityContainer.isTopDisplayFocusedStack(mTargetStack)) { mTargetStack.moveToFront("startActivityUnchecked"); mTargetStack.moveToFront("startActivityInner"); } mRootActivityContainer.resumeFocusedStacksTopActivities( mTargetStack, mStartActivity, mOptions); Loading Loading @@ -1873,7 +1887,7 @@ class ActivityStarter { mTargetStack = computeStackFocus(mSourceRecord, false /* newTask */, mLaunchFlags, mOptions); mTargetStack.addTask(targetTask, !mLaunchTaskBehind /* toTop */, "startActivityUnchecked"); !mLaunchTaskBehind /* toTop */, "complyActivityFlags"); } } } else if ((mLaunchFlags & FLAG_ACTIVITY_CLEAR_TOP) == 0 && !mAddingToTask Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +24 −7 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL; import static android.os.FactoryTest.FACTORY_TEST_OFF; import static android.os.Process.FIRST_APPLICATION_UID; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT; import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES; import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RTL; Loading Loading @@ -1606,6 +1606,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } final long origId = Binder.clearCallingIdentity(); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "finishActivity"); try { boolean res; final boolean finishWithRootActivity = Loading Loading @@ -1633,6 +1634,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } return res; } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading Loading @@ -1667,6 +1669,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { try { WindowProcessController proc = null; synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityIdle"); ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack == null) { return; Loading @@ -1681,6 +1684,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading @@ -1707,10 +1711,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public final void activityPaused(IBinder token) { final long origId = Binder.clearCallingIdentity(); synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityPaused"); ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack != null) { stack.activityPausedLocked(token, false); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } Binder.restoreCallingIdentity(origId); } Loading @@ -1731,6 +1737,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { int restartingUid = 0; final ActivityRecord r; synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityStopped"); r = ActivityRecord.isInStackLocked(token); if (r != null) { if (r.attachedToProcess() Loading @@ -1742,6 +1749,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } r.activityStoppedLocked(icicle, persistentState, description); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } if (restartingName != null) { Loading @@ -1763,12 +1771,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "ACTIVITY DESTROYED: " + token); synchronized (mGlobalLock) { final long origId = Binder.clearCallingIdentity(); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityDestroyed"); try { final ActivityRecord activity = ActivityRecord.forTokenLocked(token); if (activity != null) { activity.destroyed("activityDestroyed"); } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); Binder.restoreCallingIdentity(origId); } } Loading Loading @@ -5506,8 +5516,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { void startProcessAsync(ActivityRecord activity, boolean knownToBeDead, boolean isTop, String hostingType) { try { if (Trace.isTagEnabled(TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dispatchingStartProcess:" if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "dispatchingStartProcess:" + activity.processName); } // Post message to start process to avoid possible deadlock of calling into AMS with the Loading @@ -5517,7 +5527,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { isTop, hostingType, activity.intent.getComponent()); mH.sendMessage(m); } finally { Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } Loading Loading @@ -5670,11 +5680,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { private void updateResumedAppTrace(@Nullable ActivityRecord resumed) { if (mTracedResumedActivity != null) { Trace.asyncTraceEnd(TRACE_TAG_ACTIVITY_MANAGER, Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, constructResumedTraceName(mTracedResumedActivity.packageName), 0); } if (resumed != null) { Trace.asyncTraceBegin(TRACE_TAG_ACTIVITY_MANAGER, Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, constructResumedTraceName(resumed.packageName), 0); } mTracedResumedActivity = resumed; Loading Loading @@ -6773,7 +6783,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean attachApplication(WindowProcessController wpc) throws RemoteException { synchronized (mGlobalLockWithoutBoost) { if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "attachApplication:" + wpc.mName); } try { return mRootActivityContainer.attachApplication(wpc); } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } } Loading
services/core/java/com/android/server/wm/AppWindowToken.java +4 −2 Original line number Diff line number Diff line Loading @@ -2283,7 +2283,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } private final Runnable mAddStartingWindow = new Runnable() { private class AddStartingWindow implements Runnable { @Override public void run() { Loading Loading @@ -2343,7 +2343,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree AppWindowToken.this); } } }; } private final AddStartingWindow mAddStartingWindow = new AddStartingWindow(); private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents, Loading