Loading services/core/java/com/android/server/wm/ActivityRecord.java +34 −24 Original line number Diff line number Diff line Loading @@ -2859,12 +2859,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A app.removeActivity(this, true /* keepAssociation */); if (!app.hasActivities()) { mAtmService.clearHeavyWeightProcessIfEquals(app); // Update any services we are bound to that might care about whether // their client may have activities. // No longer have activities, so update LRU list and oom adj. app.updateProcessInfo(true /* updateServiceConnectionActivities */, false /* activityChange */, true /* updateOomAdj */, false /* addPendingTopUid */); } boolean skipDestroy = false; Loading Loading @@ -4484,16 +4478,40 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A detachChildren(); } if (state == RESUMED) { switch (state) { case RESUMED: mAtmService.updateBatteryStats(this, true); mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_RESUMED); } else if (state == PAUSED) { // Fall through. case STARTED: // Update process info while making an activity from invisible to visible, to make // sure the process state is updated to foreground. if (app != null) { app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); } break; case PAUSED: mAtmService.updateBatteryStats(this, false); mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_PAUSED); } else if (state == STOPPED) { break; case STOPPED: mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_STOPPED); } else if (state == DESTROYED) { break; case DESTROYED: mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_DESTROYED); // Fall through. case DESTROYING: if (app != null && !app.hasActivities()) { // Update any services we are bound to that might care about whether // their client may have activities. // No longer have activities, so update LRU list and oom adj. app.updateProcessInfo(true /* updateServiceConnectionActivities */, false /* activityChange */, true /* updateOomAdj */, false /* addPendingTopUid */); } break; } } Loading Loading @@ -4804,14 +4822,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } setState(STARTED, "makeActiveIfNeeded"); // Update process info while making an activity from invisible to visible, to make // sure the process state is updated to foreground. if (app != null) { app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); } try { mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken, StartActivityItem.obtain()); Loading services/core/java/com/android/server/wm/Task.java +0 −4 Original line number Diff line number Diff line Loading @@ -6190,10 +6190,6 @@ class Task extends WindowContainer<WindowContainer> { next.setState(RESUMED, "resumeTopActivityInnerLocked"); next.app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); // Have the window manager re-evaluate the orientation of // the screen based on the new activity order. boolean notUpdated = true; Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +21 −0 Original line number Diff line number Diff line Loading @@ -1714,6 +1714,27 @@ public class ActivityRecordTests extends WindowTestsBase { } @Test public void testProcessInfoUpdateWhenSetState() { spyOn(mActivity.app); verifyProcessInfoUpdate(RESUMED, true /* shouldUpdate */, true /* activityChange */); verifyProcessInfoUpdate(PAUSED, false /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(STOPPED, false /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(STARTED, true /* shouldUpdate */, true /* activityChange */); mActivity.app.removeActivity(mActivity, true /* keepAssociation */); verifyProcessInfoUpdate(DESTROYING, true /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(DESTROYED, true /* shouldUpdate */, false /* activityChange */); } private void verifyProcessInfoUpdate(ActivityState state, boolean shouldUpdate, boolean activityChange) { reset(mActivity.app); mActivity.setState(state, "test"); verify(mActivity.app, times(shouldUpdate ? 1 : 0)).updateProcessInfo(anyBoolean(), eq(activityChange), anyBoolean(), anyBoolean()); } /** * Creates an activity on display. For non-default display request it will also create a new * display with custom DisplayInfo. Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +34 −24 Original line number Diff line number Diff line Loading @@ -2859,12 +2859,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A app.removeActivity(this, true /* keepAssociation */); if (!app.hasActivities()) { mAtmService.clearHeavyWeightProcessIfEquals(app); // Update any services we are bound to that might care about whether // their client may have activities. // No longer have activities, so update LRU list and oom adj. app.updateProcessInfo(true /* updateServiceConnectionActivities */, false /* activityChange */, true /* updateOomAdj */, false /* addPendingTopUid */); } boolean skipDestroy = false; Loading Loading @@ -4484,16 +4478,40 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A detachChildren(); } if (state == RESUMED) { switch (state) { case RESUMED: mAtmService.updateBatteryStats(this, true); mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_RESUMED); } else if (state == PAUSED) { // Fall through. case STARTED: // Update process info while making an activity from invisible to visible, to make // sure the process state is updated to foreground. if (app != null) { app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); } break; case PAUSED: mAtmService.updateBatteryStats(this, false); mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_PAUSED); } else if (state == STOPPED) { break; case STOPPED: mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_STOPPED); } else if (state == DESTROYED) { break; case DESTROYED: mAtmService.updateActivityUsageStats(this, Event.ACTIVITY_DESTROYED); // Fall through. case DESTROYING: if (app != null && !app.hasActivities()) { // Update any services we are bound to that might care about whether // their client may have activities. // No longer have activities, so update LRU list and oom adj. app.updateProcessInfo(true /* updateServiceConnectionActivities */, false /* activityChange */, true /* updateOomAdj */, false /* addPendingTopUid */); } break; } } Loading Loading @@ -4804,14 +4822,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } setState(STARTED, "makeActiveIfNeeded"); // Update process info while making an activity from invisible to visible, to make // sure the process state is updated to foreground. if (app != null) { app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); } try { mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken, StartActivityItem.obtain()); Loading
services/core/java/com/android/server/wm/Task.java +0 −4 Original line number Diff line number Diff line Loading @@ -6190,10 +6190,6 @@ class Task extends WindowContainer<WindowContainer> { next.setState(RESUMED, "resumeTopActivityInnerLocked"); next.app.updateProcessInfo(false /* updateServiceConnectionActivities */, true /* activityChange */, true /* updateOomAdj */, true /* addPendingTopUid */); // Have the window manager re-evaluate the orientation of // the screen based on the new activity order. boolean notUpdated = true; Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +21 −0 Original line number Diff line number Diff line Loading @@ -1714,6 +1714,27 @@ public class ActivityRecordTests extends WindowTestsBase { } @Test public void testProcessInfoUpdateWhenSetState() { spyOn(mActivity.app); verifyProcessInfoUpdate(RESUMED, true /* shouldUpdate */, true /* activityChange */); verifyProcessInfoUpdate(PAUSED, false /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(STOPPED, false /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(STARTED, true /* shouldUpdate */, true /* activityChange */); mActivity.app.removeActivity(mActivity, true /* keepAssociation */); verifyProcessInfoUpdate(DESTROYING, true /* shouldUpdate */, false /* activityChange */); verifyProcessInfoUpdate(DESTROYED, true /* shouldUpdate */, false /* activityChange */); } private void verifyProcessInfoUpdate(ActivityState state, boolean shouldUpdate, boolean activityChange) { reset(mActivity.app); mActivity.setState(state, "test"); verify(mActivity.app, times(shouldUpdate ? 1 : 0)).updateProcessInfo(anyBoolean(), eq(activityChange), anyBoolean(), anyBoolean()); } /** * Creates an activity on display. For non-default display request it will also create a new * display with custom DisplayInfo. Loading