Do not add layout reason if there is no config effect

The condition seems to be reversed. That causes a no-op window
container transaction to perform surface placement.

Bug: 235323163
Test: atest TaskFragmentOrganizerControllerTest
Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot
      Record trace with aidl tag. Launch an app. There should not
      have a performSurfacePlacement in
      IWindowOrganizerController:startTransition.
Change-Id: I6485c7838dd3ca5ac8905cf86513ad1a84e66f1f
This commit is contained in:
Riddle Hsu
2022-06-08 21:23:09 +08:00
parent bba05dfecc
commit 698d9d0ca5
3 changed files with 7 additions and 3 deletions

View File

@@ -470,6 +470,8 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr
.setException(exception)
.build();
mPendingTaskFragmentEvents.add(pendingEvent);
// Make sure the error event will be dispatched if there are no other changes.
mAtmService.mWindowManager.mWindowPlacerLocked.requestTraversal();
}
void onActivityReparentToTask(ActivityRecord activity) {

View File

@@ -525,7 +525,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
}
}
if ((effects & TRANSACT_EFFECTS_CLIENT_CONFIG) == 0) {
if ((effects & TRANSACT_EFFECTS_CLIENT_CONFIG) != 0) {
mService.addWindowLayoutReasons(LAYOUT_REASON_CONFIG_CHANGED);
}
} finally {

View File

@@ -922,13 +922,14 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase {
.build();
doReturn(true).when(mTaskFragment).isAllowedToEmbedActivity(activity);
mWindowOrganizerController.mLaunchTaskFragments.put(mFragmentToken, mTaskFragment);
clearInvocations(mAtm.mRootWindowContainer);
// Reparent activity to mTaskFragment, which is smaller than activity's
// minimum dimensions.
mTransaction.reparentActivityToTaskFragment(mFragmentToken, activity.token)
.setErrorCallbackToken(mErrorToken);
mWindowOrganizerController.applyTransaction(mTransaction);
// The pending event will be dispatched on the handler (from requestTraversal).
waitHandlerIdle(mWm.mAnimationHandler);
verify(mOrganizer).onTaskFragmentError(eq(mErrorToken), any(SecurityException.class));
}
@@ -958,7 +959,6 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase {
doReturn(true).when(mTaskFragment).isAllowedToEmbedActivity(activity);
mWindowOrganizerController.mLaunchTaskFragments.put(oldFragToken, oldTaskFrag);
mWindowOrganizerController.mLaunchTaskFragments.put(mFragmentToken, mTaskFragment);
clearInvocations(mAtm.mRootWindowContainer);
// Reparent oldTaskFrag's children to mTaskFragment, which is smaller than activity's
// minimum dimensions.
@@ -966,6 +966,8 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase {
mTaskFragment.mRemoteToken.toWindowContainerToken())
.setErrorCallbackToken(mErrorToken);
mWindowOrganizerController.applyTransaction(mTransaction);
// The pending event will be dispatched on the handler (from requestTraversal).
waitHandlerIdle(mWm.mAnimationHandler);
verify(mOrganizer).onTaskFragmentError(eq(mErrorToken), any(SecurityException.class));
}