diff options
| author | 2024-10-09 00:20:50 +0000 | |
|---|---|---|
| committer | 2024-10-09 00:20:50 +0000 | |
| commit | d0f95ff02cac38a2d5a5e9019a8d5b41ec59c2d8 (patch) | |
| tree | f6d1f9c17eb668ccc238e3c39dca5b35a5130a3e | |
| parent | 8238a470f6ebe41ddb0e9fa99e2f0decfa82ad68 (diff) | |
| parent | 292ae8c060b23750422af0f822c0ca297addbfb7 (diff) | |
Merge "Update PAUSE usage state when activity move from RESUMED to STOPPING" into main
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 31f4d081d913..74aa908660ac 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -5877,6 +5877,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } + final State prevState = mState; mState = state; if (getTaskFragment() != null) { @@ -5917,6 +5918,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mAtmService.updateBatteryStats(this, false); mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_PAUSED); break; + case STOPPING: + // It is possible that an Activity is scheduled to be STOPPED directly from RESUMED + // state. Updating the PAUSED usage state in that case, since the Activity will be + // STOPPED while cycled through the PAUSED state. + if (prevState == RESUMED) { + mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_PAUSED); + } + break; case STOPPED: mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_STOPPED); if (mDisplayContent != null) { |