Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +19 −19 Original line number Diff line number Diff line Loading @@ -317,14 +317,14 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { * receivers to launch an activity and get that to run before the device * goes back to sleep. */ PowerManager.WakeLock mLaunchingActivity; PowerManager.WakeLock mLaunchingActivityWakeLock; /** * Set when the system is going to sleep, until we have * successfully paused the current activity and released our wake lock. * At that point the system is allowed to actually sleep. */ PowerManager.WakeLock mGoingToSleep; PowerManager.WakeLock mGoingToSleepWakeLock; /** * Temporary rect used during docked stack resize calculation so we don't need to create a new Loading Loading @@ -467,10 +467,10 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { */ void initPowerManagement() { mPowerManager = mService.mContext.getSystemService(PowerManager.class); mGoingToSleep = mPowerManager mGoingToSleepWakeLock = mPowerManager .newWakeLock(PARTIAL_WAKE_LOCK, "ActivityManager-Sleep"); mLaunchingActivity = mPowerManager.newWakeLock(PARTIAL_WAKE_LOCK, "*launch*"); mLaunchingActivity.setReferenceCounted(false); mLaunchingActivityWakeLock = mPowerManager.newWakeLock(PARTIAL_WAKE_LOCK, "*launch*"); mLaunchingActivityWakeLock.setReferenceCounted(false); } void setWindowManager(WindowManagerService wm) { Loading Loading @@ -1213,14 +1213,14 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } void setLaunchSource(int uid) { mLaunchingActivity.setWorkSource(new WorkSource(uid)); mLaunchingActivityWakeLock.setWorkSource(new WorkSource(uid)); } void acquireLaunchWakelock() { if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.acquire(); mLaunchingActivityWakeLock.acquire(); if (!mHandler.hasMessages(LAUNCH_TIMEOUT_MSG)) { // To be safe, don't allow the wake lock to be held for too long. mHandler.sendEmptyMessageDelayed(LAUNCH_TIMEOUT_MSG, LAUNCH_TIMEOUT); Loading Loading @@ -1302,13 +1302,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { mService.scheduleAppGcsLocked(); } if (mLaunchingActivity.isHeld()) { if (mLaunchingActivityWakeLock.isHeld()) { mHandler.removeMessages(LAUNCH_TIMEOUT_MSG); if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); } mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); } Loading Loading @@ -1972,13 +1972,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { void goingToSleepLocked() { scheduleSleepTimeout(); if (!mGoingToSleep.isHeld()) { mGoingToSleep.acquire(); if (mLaunchingActivity.isHeld()) { if (!mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.acquire(); if (mLaunchingActivityWakeLock.isHeld()) { if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); mHandler.removeMessages(LAUNCH_TIMEOUT_MSG); } } Loading Loading @@ -2020,8 +2020,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { void comeOutOfSleepIfNeededLocked() { removeSleepTimeouts(); if (mGoingToSleep.isHeld()) { mGoingToSleep.release(); if (mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.release(); } } Loading Loading @@ -2051,8 +2051,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { removeSleepTimeouts(); if (mGoingToSleep.isHeld()) { mGoingToSleep.release(); if (mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.release(); } if (mService.mShuttingDown) { mService.mGlobalLock.notifyAll(); Loading Loading @@ -2561,13 +2561,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } break; case LAUNCH_TIMEOUT_MSG: { synchronized (mService.mGlobalLock) { if (mLaunchingActivity.isHeld()) { if (mLaunchingActivityWakeLock.isHeld()) { Slog.w(TAG, "Launch timeout has expired, giving up wake lock!"); if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); } } } break; Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +6 −4 Original line number Diff line number Diff line Loading @@ -6841,8 +6841,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { pw.println(" mController=" + mController + " mControllerIsAMonkey=" + mControllerIsAMonkey); } pw.println(" mGoingToSleep=" + mStackSupervisor.mGoingToSleep); pw.println(" mLaunchingActivity=" + mStackSupervisor.mLaunchingActivity); pw.println(" mGoingToSleepWakeLock=" + mStackSupervisor.mGoingToSleepWakeLock); pw.println(" mLaunchingActivityWakeLock=" + mStackSupervisor.mLaunchingActivityWakeLock); } return needSep; Loading Loading @@ -6874,8 +6875,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { proto.write(IS_A_MONKEY, mControllerIsAMonkey); proto.end(token); } mStackSupervisor.mGoingToSleep.writeToProto(proto, GOING_TO_SLEEP); mStackSupervisor.mLaunchingActivity.writeToProto(proto, LAUNCHING_ACTIVITY); mStackSupervisor.mGoingToSleepWakeLock.writeToProto(proto, GOING_TO_SLEEP); mStackSupervisor.mLaunchingActivityWakeLock.writeToProto(proto, LAUNCHING_ACTIVITY); } if (mHomeProcess != null && (dumpPackage == null Loading services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -594,7 +594,7 @@ class ActivityTestsBase { doNothing().when(this).acquireLaunchWakelock(); doReturn(mKeyguardController).when(this).getKeyguardController(); mLaunchingActivity = mock(PowerManager.WakeLock.class); mLaunchingActivityWakeLock = mock(PowerManager.WakeLock.class); initialize(); } Loading Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +19 −19 Original line number Diff line number Diff line Loading @@ -317,14 +317,14 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { * receivers to launch an activity and get that to run before the device * goes back to sleep. */ PowerManager.WakeLock mLaunchingActivity; PowerManager.WakeLock mLaunchingActivityWakeLock; /** * Set when the system is going to sleep, until we have * successfully paused the current activity and released our wake lock. * At that point the system is allowed to actually sleep. */ PowerManager.WakeLock mGoingToSleep; PowerManager.WakeLock mGoingToSleepWakeLock; /** * Temporary rect used during docked stack resize calculation so we don't need to create a new Loading Loading @@ -467,10 +467,10 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { */ void initPowerManagement() { mPowerManager = mService.mContext.getSystemService(PowerManager.class); mGoingToSleep = mPowerManager mGoingToSleepWakeLock = mPowerManager .newWakeLock(PARTIAL_WAKE_LOCK, "ActivityManager-Sleep"); mLaunchingActivity = mPowerManager.newWakeLock(PARTIAL_WAKE_LOCK, "*launch*"); mLaunchingActivity.setReferenceCounted(false); mLaunchingActivityWakeLock = mPowerManager.newWakeLock(PARTIAL_WAKE_LOCK, "*launch*"); mLaunchingActivityWakeLock.setReferenceCounted(false); } void setWindowManager(WindowManagerService wm) { Loading Loading @@ -1213,14 +1213,14 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } void setLaunchSource(int uid) { mLaunchingActivity.setWorkSource(new WorkSource(uid)); mLaunchingActivityWakeLock.setWorkSource(new WorkSource(uid)); } void acquireLaunchWakelock() { if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.acquire(); mLaunchingActivityWakeLock.acquire(); if (!mHandler.hasMessages(LAUNCH_TIMEOUT_MSG)) { // To be safe, don't allow the wake lock to be held for too long. mHandler.sendEmptyMessageDelayed(LAUNCH_TIMEOUT_MSG, LAUNCH_TIMEOUT); Loading Loading @@ -1302,13 +1302,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { mService.scheduleAppGcsLocked(); } if (mLaunchingActivity.isHeld()) { if (mLaunchingActivityWakeLock.isHeld()) { mHandler.removeMessages(LAUNCH_TIMEOUT_MSG); if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); } mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); } Loading Loading @@ -1972,13 +1972,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { void goingToSleepLocked() { scheduleSleepTimeout(); if (!mGoingToSleep.isHeld()) { mGoingToSleep.acquire(); if (mLaunchingActivity.isHeld()) { if (!mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.acquire(); if (mLaunchingActivityWakeLock.isHeld()) { if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); mHandler.removeMessages(LAUNCH_TIMEOUT_MSG); } } Loading Loading @@ -2020,8 +2020,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { void comeOutOfSleepIfNeededLocked() { removeSleepTimeouts(); if (mGoingToSleep.isHeld()) { mGoingToSleep.release(); if (mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.release(); } } Loading Loading @@ -2051,8 +2051,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { removeSleepTimeouts(); if (mGoingToSleep.isHeld()) { mGoingToSleep.release(); if (mGoingToSleepWakeLock.isHeld()) { mGoingToSleepWakeLock.release(); } if (mService.mShuttingDown) { mService.mGlobalLock.notifyAll(); Loading Loading @@ -2561,13 +2561,13 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } break; case LAUNCH_TIMEOUT_MSG: { synchronized (mService.mGlobalLock) { if (mLaunchingActivity.isHeld()) { if (mLaunchingActivityWakeLock.isHeld()) { Slog.w(TAG, "Launch timeout has expired, giving up wake lock!"); if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); } mLaunchingActivity.release(); mLaunchingActivityWakeLock.release(); } } } break; Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +6 −4 Original line number Diff line number Diff line Loading @@ -6841,8 +6841,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { pw.println(" mController=" + mController + " mControllerIsAMonkey=" + mControllerIsAMonkey); } pw.println(" mGoingToSleep=" + mStackSupervisor.mGoingToSleep); pw.println(" mLaunchingActivity=" + mStackSupervisor.mLaunchingActivity); pw.println(" mGoingToSleepWakeLock=" + mStackSupervisor.mGoingToSleepWakeLock); pw.println(" mLaunchingActivityWakeLock=" + mStackSupervisor.mLaunchingActivityWakeLock); } return needSep; Loading Loading @@ -6874,8 +6875,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { proto.write(IS_A_MONKEY, mControllerIsAMonkey); proto.end(token); } mStackSupervisor.mGoingToSleep.writeToProto(proto, GOING_TO_SLEEP); mStackSupervisor.mLaunchingActivity.writeToProto(proto, LAUNCHING_ACTIVITY); mStackSupervisor.mGoingToSleepWakeLock.writeToProto(proto, GOING_TO_SLEEP); mStackSupervisor.mLaunchingActivityWakeLock.writeToProto(proto, LAUNCHING_ACTIVITY); } if (mHomeProcess != null && (dumpPackage == null Loading
services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -594,7 +594,7 @@ class ActivityTestsBase { doNothing().when(this).acquireLaunchWakelock(); doReturn(mKeyguardController).when(this).getKeyguardController(); mLaunchingActivity = mock(PowerManager.WakeLock.class); mLaunchingActivityWakeLock = mock(PowerManager.WakeLock.class); initialize(); } Loading