Merge "Clear mTranslucentActivityWaiting if the activity is going to relaunch" into sc-dev

This commit is contained in:
Wei Sheng Shih
2021-04-21 11:07:23 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 1 deletions

View File

@@ -5154,6 +5154,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// Task#ensureActivitiesVisible will bring the activity to a proper
// active state.
if (!isState(STARTED, RESUMED, PAUSED, STOPPED, STOPPING)
// TODO (b/185876784) Check could we remove the check condition
// mTranslucentActivityWaiting != null here
|| getRootTask().mTranslucentActivityWaiting != null) {
return false;
}
@@ -7802,7 +7804,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
configChangeFlags = 0;
return;
}
// Do not waiting for translucent activity if it is going to relaunch.
final Task rootTask = getRootTask();
if (rootTask != null && rootTask.mTranslucentActivityWaiting == this) {
rootTask.checkTranslucentActivityWaiting(null);
}
final boolean andResume = shouldBeResumed(null /*activeActivity*/);
List<ResultInfo> pendingResults = null;
List<ReferrerIntent> pendingNewIntents = null;

View File

@@ -386,6 +386,27 @@ public class ActivityRecordTests extends WindowTestsBase {
activity.mRelaunchReason);
}
@Test
public void testRelaunchClearTopWaitingTranslucent() {
final ActivityRecord activity = createActivityWithTask();
final Task task = activity.getTask();
activity.setState(Task.ActivityState.RESUMED, "Testing");
task.onRequestedOverrideConfigurationChanged(task.getConfiguration());
activity.setLastReportedConfiguration(new MergedConfiguration(new Configuration(),
activity.getConfiguration()));
activity.info.configChanges &= ~CONFIG_ORIENTATION;
final Configuration newConfig = new Configuration(task.getConfiguration());
newConfig.orientation = newConfig.orientation == ORIENTATION_PORTRAIT
? ORIENTATION_LANDSCAPE
: ORIENTATION_PORTRAIT;
task.onRequestedOverrideConfigurationChanged(newConfig);
task.mTranslucentActivityWaiting = activity;
ensureActivityConfiguration(activity);
assertNull(task.mTranslucentActivityWaiting);
}
@Test
public void testSetsRelaunchReason_NonResizeConfigChanges() {
final ActivityRecord activity = createActivityWithTask();