From 68391260368b1ae444441db172ce72f75ce13852 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Mon, 17 Aug 2020 10:48:53 +0800 Subject: [PATCH] Update process info while making activity visible The top fullscreen activity converted to translucent while running exit transition, which resulted in the activity below being visible. Since the the process state of the activity below remained as background, some operations required to be done as a foreground (opening camera) was being rejected. Bug: 162216572 Test: back to camera from filmstrip Change-Id: Ib746f5a2c5409f142819f7eba89c7948c756c23e --- .../core/java/com/android/server/wm/ActivityRecord.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 3e9377ed06649..7daea69929438 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4735,6 +4735,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A Slog.v(TAG_VISIBILITY, "Start visible activity, " + this); } 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());