Merge "Updates visibility before trying to notify task stack changes" into rvc-dev

This commit is contained in:
Louis Chang
2020-05-10 13:42:56 +00:00
committed by Android (Google) Code Review
3 changed files with 29 additions and 2 deletions

View File

@@ -1276,6 +1276,8 @@ class ActivityStack extends Task {
prev.cpuTimeAtResume = 0; // reset it
}
mRootWindowContainer.ensureActivitiesVisible(resuming, 0, !PRESERVE_WINDOWS);
// Notify when the task stack has changed, but only if visibilities changed (not just
// focus). Also if there is an active pinned stack - we always want to notify it about
// task stack changes, because its positioning may depend on it.
@@ -1284,8 +1286,6 @@ class ActivityStack extends Task {
mAtmService.getTaskChangeNotificationController().notifyTaskStackChanged();
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false;
}
mRootWindowContainer.ensureActivitiesVisible(resuming, 0, !PRESERVE_WINDOWS);
}
boolean isTopStackInDisplayArea() {

View File

@@ -58,6 +58,8 @@
android:screenOrientation="sensorLandscape"
android:showWhenLocked="true"
android:turnScreenOn="true" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ResumeWhilePausingActivity"
android:resumeWhilePausing="true"/>
<activity android:name="com.android.server.wm.ScreenDecorWindowTests$TestActivity"
android:showWhenLocked="true" android:allowEmbedded="true"/>
</application>

View File

@@ -81,6 +81,7 @@ public class TaskStackChangedListenerTest {
@Before
public void setUp() throws Exception {
mService = ActivityManager.getService();
sTaskStackChangedCalled = false;
}
@After
@@ -112,6 +113,28 @@ public class TaskStackChangedListenerTest {
assertTrue(sActivityBResumed);
}
@Test
@Presubmit
public void testTaskStackChanged_resumeWhilePausing() throws Exception {
registerTaskStackChangedListener(new TaskStackListener() {
@Override
public void onTaskStackChanged() throws RemoteException {
synchronized (sLock) {
sTaskStackChangedCalled = true;
}
}
});
final Context context = getInstrumentation().getContext();
context.startActivity(new Intent(context, ResumeWhilePausingActivity.class).addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK));
UiDevice.getInstance(getInstrumentation()).waitForIdle();
synchronized (sLock) {
assertTrue(sTaskStackChangedCalled);
}
}
@Test
@Presubmit
public void testTaskDescriptionChanged() throws Exception {
@@ -617,5 +640,7 @@ public class TaskStackChangedListenerTest {
// Activity that has {@link android.R.attr#resizeableActivity} attribute set to {@code true}
public static class ActivityInActivityView extends TestActivity {}
public static class ResumeWhilePausingActivity extends TestActivity {}
public static class LandscapeActivity extends TestActivity {}
}