Loading services/core/java/com/android/server/wm/ActivityRecord.java +7 −18 Original line number Diff line number Diff line Loading @@ -499,7 +499,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // process that it is hidden. private boolean mLastDeferHidingClient; // If true we will defer setting mClientVisible to false // and reporting to the client that it is hidden. private boolean mSetToSleep; // have we told the activity to sleep? boolean nowVisible; // is this activity's window visible? boolean mClientVisibilityDeferred;// was the visibility change message to client deferred? boolean idle; // has the activity gone idle? Loading Loading @@ -906,7 +905,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" setToSleep="); pw.print(mSetToSleep); pw.print(" idle="); pw.print(idle); pw.print(" mStartingWindowState="); pw.println(startingWindowStateToString(mStartingWindowState)); Loading Loading @@ -4682,15 +4680,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Check if the activity is on a sleeping display // TODO b/163993448 mSetToSleep is required when restarting an existing activity, try to // remove it if possible. if (mSetToSleep && mDisplayContent.isSleeping()) { return false; } // Check if the activity is on a sleeping display, canTurnScreenOn will also check // keyguard visibility if (mDisplayContent.isSleeping()) { return canTurnScreenOn(); } else { return mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this); } } void updateVisibilityIgnoringKeyguard(boolean behindFullscreenActivity) { visibleIgnoringKeyguard = (!behindFullscreenActivity || mLaunchTaskBehind) Loading Loading @@ -4726,7 +4723,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A stack.mUndrawnActivitiesBelowTopTranslucent.add(this); } setVisibility(true); mSetToSleep = false; app.postPendingUiCleanMsg(true); if (reportToClient) { mClientVisibilityDeferred = false; Loading Loading @@ -5125,9 +5121,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken, StopActivityItem.obtain(configChangeFlags)); if (stack.shouldSleepOrShutDownActivities()) { setSleeping(true); } mAtmService.mH.postDelayed(mStopTimeoutRunnable, STOP_TIMEOUT); } catch (Exception e) { // Maybe just ignore exceptions here... if the process has crashed, our death Loading Loading @@ -5718,10 +5711,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mVisibleRequested || nowVisible || mState == PAUSING || mState == RESUMED; } void setSleeping(boolean sleeping) { mSetToSleep = sleeping; } static int getTaskForActivityLocked(IBinder token, boolean onlyRoot) { final ActivityRecord r = ActivityRecord.forTokenLocked(token); if (r == null || r.getParent() == null) { Loading Loading @@ -7568,7 +7557,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } final Task stack = getRootTask(); return stack != null return mCurrentLaunchCanTurnScreenOn && stack != null && mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this); } Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +0 −1 Original line number Diff line number Diff line Loading @@ -820,7 +820,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } mService.getPackageManagerInternalLocked().notifyPackageUse( r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY); r.setSleeping(false); r.forceNewConfig = false; mService.getAppWarningsLocked().onStartActivity(r); r.compat = mService.compatibilityInfoForPackageLocked(r.info.applicationInfo); Loading services/core/java/com/android/server/wm/ActivityStarter.java +4 −0 Original line number Diff line number Diff line Loading @@ -2546,6 +2546,10 @@ class ActivityStarter { private void resumeTargetStackIfNeeded() { if (mDoResume) { final ActivityRecord next = mTargetStack.topRunningActivity(true /* focusableOnly */); if (next != null) { next.setCurrentLaunchCanTurnScreenOn(true); } mRootWindowContainer.resumeFocusedStacksTopActivities(mTargetStack, null, mOptions); } else { ActivityOptions.abort(mOptions); Loading services/core/java/com/android/server/wm/RootWindowContainer.java +3 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_L import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityStackSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityStackSupervisor.ON_TOP; import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.ActivityStackSupervisor.dumpHistoryList; import static com.android.server.wm.ActivityStackSupervisor.printThisActivity; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_RECENTS; Loading Loading @@ -2779,7 +2780,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> if (allowDelay) { result &= stack.goToSleepIfPossible(shuttingDown); } else { stack.goToSleep(); stack.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } } return result; Loading services/core/java/com/android/server/wm/Task.java +2 −20 Original line number Diff line number Diff line Loading @@ -5414,8 +5414,6 @@ class Task extends WindowContainer<WindowContainer> { } void awakeFromSleepingLocked() { // Ensure activities are no longer sleeping. forAllActivities((Consumer<ActivityRecord>) (r) -> r.setSleeping(false)); if (mPausingActivity != null) { Slog.d(TAG, "awakeFromSleepingLocked: previously pausing activity didn't pause"); mPausingActivity.activityPaused(true); Loading Loading @@ -5469,27 +5467,13 @@ class Task extends WindowContainer<WindowContainer> { } if (shouldSleep) { goToSleep(); ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } return shouldSleep; } void goToSleep() { // Make sure all visible activities are now sleeping. This will update the activity's // visibility and onStop() will be called. forAllActivities((r) -> { if (r.isState(STARTED, RESUMED, PAUSING, PAUSED, STOPPING, STOPPED)) { r.setSleeping(true); } }); // Ensure visibility after updating sleep states without updating configuration, // as activities are about to be sent to sleep. ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } private boolean containsActivityFromStack(List<ActivityRecord> rs) { for (ActivityRecord r : rs) { if (r.getRootTask() == this) { Loading Loading @@ -6022,7 +6006,6 @@ class Task extends WindowContainer<WindowContainer> { // The activity may be waiting for stop, but that is no longer // appropriate for it. mStackSupervisor.mStoppingActivities.remove(next); next.setSleeping(false); if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next); Loading Loading @@ -6295,7 +6278,6 @@ class Task extends WindowContainer<WindowContainer> { EventLogTags.writeWmResumeActivity(next.mUserId, System.identityHashCode(next), next.getTask().mTaskId, next.shortComponentName); next.setSleeping(false); mAtmService.getAppWarningsLocked().onResumeActivity(next); next.app.setPendingUiCleanAndForceProcessStateUpTo(mAtmService.mTopProcessState); next.clearOptionsLocked(); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +7 −18 Original line number Diff line number Diff line Loading @@ -499,7 +499,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // process that it is hidden. private boolean mLastDeferHidingClient; // If true we will defer setting mClientVisible to false // and reporting to the client that it is hidden. private boolean mSetToSleep; // have we told the activity to sleep? boolean nowVisible; // is this activity's window visible? boolean mClientVisibilityDeferred;// was the visibility change message to client deferred? boolean idle; // has the activity gone idle? Loading Loading @@ -906,7 +905,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" setToSleep="); pw.print(mSetToSleep); pw.print(" idle="); pw.print(idle); pw.print(" mStartingWindowState="); pw.println(startingWindowStateToString(mStartingWindowState)); Loading Loading @@ -4682,15 +4680,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Check if the activity is on a sleeping display // TODO b/163993448 mSetToSleep is required when restarting an existing activity, try to // remove it if possible. if (mSetToSleep && mDisplayContent.isSleeping()) { return false; } // Check if the activity is on a sleeping display, canTurnScreenOn will also check // keyguard visibility if (mDisplayContent.isSleeping()) { return canTurnScreenOn(); } else { return mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this); } } void updateVisibilityIgnoringKeyguard(boolean behindFullscreenActivity) { visibleIgnoringKeyguard = (!behindFullscreenActivity || mLaunchTaskBehind) Loading Loading @@ -4726,7 +4723,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A stack.mUndrawnActivitiesBelowTopTranslucent.add(this); } setVisibility(true); mSetToSleep = false; app.postPendingUiCleanMsg(true); if (reportToClient) { mClientVisibilityDeferred = false; Loading Loading @@ -5125,9 +5121,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken, StopActivityItem.obtain(configChangeFlags)); if (stack.shouldSleepOrShutDownActivities()) { setSleeping(true); } mAtmService.mH.postDelayed(mStopTimeoutRunnable, STOP_TIMEOUT); } catch (Exception e) { // Maybe just ignore exceptions here... if the process has crashed, our death Loading Loading @@ -5718,10 +5711,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mVisibleRequested || nowVisible || mState == PAUSING || mState == RESUMED; } void setSleeping(boolean sleeping) { mSetToSleep = sleeping; } static int getTaskForActivityLocked(IBinder token, boolean onlyRoot) { final ActivityRecord r = ActivityRecord.forTokenLocked(token); if (r == null || r.getParent() == null) { Loading Loading @@ -7568,7 +7557,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } final Task stack = getRootTask(); return stack != null return mCurrentLaunchCanTurnScreenOn && stack != null && mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this); } Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +0 −1 Original line number Diff line number Diff line Loading @@ -820,7 +820,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } mService.getPackageManagerInternalLocked().notifyPackageUse( r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY); r.setSleeping(false); r.forceNewConfig = false; mService.getAppWarningsLocked().onStartActivity(r); r.compat = mService.compatibilityInfoForPackageLocked(r.info.applicationInfo); Loading
services/core/java/com/android/server/wm/ActivityStarter.java +4 −0 Original line number Diff line number Diff line Loading @@ -2546,6 +2546,10 @@ class ActivityStarter { private void resumeTargetStackIfNeeded() { if (mDoResume) { final ActivityRecord next = mTargetStack.topRunningActivity(true /* focusableOnly */); if (next != null) { next.setCurrentLaunchCanTurnScreenOn(true); } mRootWindowContainer.resumeFocusedStacksTopActivities(mTargetStack, null, mOptions); } else { ActivityOptions.abort(mOptions); Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +3 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_L import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityStackSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityStackSupervisor.ON_TOP; import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.ActivityStackSupervisor.dumpHistoryList; import static com.android.server.wm.ActivityStackSupervisor.printThisActivity; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_RECENTS; Loading Loading @@ -2779,7 +2780,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> if (allowDelay) { result &= stack.goToSleepIfPossible(shuttingDown); } else { stack.goToSleep(); stack.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } } return result; Loading
services/core/java/com/android/server/wm/Task.java +2 −20 Original line number Diff line number Diff line Loading @@ -5414,8 +5414,6 @@ class Task extends WindowContainer<WindowContainer> { } void awakeFromSleepingLocked() { // Ensure activities are no longer sleeping. forAllActivities((Consumer<ActivityRecord>) (r) -> r.setSleeping(false)); if (mPausingActivity != null) { Slog.d(TAG, "awakeFromSleepingLocked: previously pausing activity didn't pause"); mPausingActivity.activityPaused(true); Loading Loading @@ -5469,27 +5467,13 @@ class Task extends WindowContainer<WindowContainer> { } if (shouldSleep) { goToSleep(); ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } return shouldSleep; } void goToSleep() { // Make sure all visible activities are now sleeping. This will update the activity's // visibility and onStop() will be called. forAllActivities((r) -> { if (r.isState(STARTED, RESUMED, PAUSING, PAUSED, STOPPING, STOPPED)) { r.setSleeping(true); } }); // Ensure visibility after updating sleep states without updating configuration, // as activities are about to be sent to sleep. ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); } private boolean containsActivityFromStack(List<ActivityRecord> rs) { for (ActivityRecord r : rs) { if (r.getRootTask() == this) { Loading Loading @@ -6022,7 +6006,6 @@ class Task extends WindowContainer<WindowContainer> { // The activity may be waiting for stop, but that is no longer // appropriate for it. mStackSupervisor.mStoppingActivities.remove(next); next.setSleeping(false); if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next); Loading Loading @@ -6295,7 +6278,6 @@ class Task extends WindowContainer<WindowContainer> { EventLogTags.writeWmResumeActivity(next.mUserId, System.identityHashCode(next), next.getTask().mTaskId, next.shortComponentName); next.setSleeping(false); mAtmService.getAppWarningsLocked().onResumeActivity(next); next.app.setPendingUiCleanAndForceProcessStateUpTo(mAtmService.mTopProcessState); next.clearOptionsLocked(); Loading