Dismiss immersive mode confirmation on setting changed to confirm

So the test won't be disturbed if the confirmation window was shown
before running the test.

Also change the strange invocation updateRotation to request
traversal of window hierarchy.

Bug: 185112691
Test: atest CtsWindowManagerDeviceTestCases
Change-Id: I2d18b5a14655418992f019c5a81c59a61db7ef3d
This commit is contained in:
Riddle Hsu
2021-05-06 22:46:40 +08:00
parent 690dd68dcc
commit 702928a093
3 changed files with 27 additions and 9 deletions

View File

@@ -2861,6 +2861,10 @@ public class DisplayPolicy {
mImmersiveModeConfirmation.onLockTaskModeChangedLw(lockTaskState);
}
boolean onSystemUiSettingsChanged() {
return mImmersiveModeConfirmation.onSettingChanged(mService.mCurrentUserId);
}
/**
* Request a screenshot be taken.
*

View File

@@ -148,6 +148,15 @@ public class ImmersiveModeConfirmation {
}
}
boolean onSettingChanged(int currentUserId) {
final boolean changed = loadSetting(currentUserId, mContext);
// Remove the window if the setting changes to be confirmed.
if (changed && sConfirmed) {
mHandler.sendEmptyMessage(H.HIDE);
}
return changed;
}
void immersiveModeChangedLw(int rootDisplayAreaId, boolean isImmersiveMode,
boolean userSetupComplete, boolean navBarEmpty) {
mHandler.removeMessages(H.SHOW);

View File

@@ -818,7 +818,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (mImmersiveModeConfirmationsUri.equals(uri) || mPolicyControlUri.equals(uri)) {
updateSystemUiSettings();
updateSystemUiSettings(true /* handleChange */);
return;
}
@@ -874,17 +874,22 @@ public class WindowManagerService extends IWindowManager.Stub
}
void loadSettings() {
updateSystemUiSettings();
updateSystemUiSettings(false /* handleChange */);
updatePointerLocation();
}
void updateSystemUiSettings() {
boolean changed;
void updateSystemUiSettings(boolean handleChange) {
synchronized (mGlobalLock) {
changed = ImmersiveModeConfirmation.loadSetting(mCurrentUserId, mContext);
}
if (changed) {
updateRotation(false /* alwaysSendConfiguration */, false /* forceRelayout */);
boolean changed = false;
if (handleChange) {
changed = getDefaultDisplayContentLocked().getDisplayPolicy()
.onSystemUiSettingsChanged();
} else {
ImmersiveModeConfirmation.loadSetting(mCurrentUserId, mContext);
}
if (changed) {
mWindowPlacerLocked.requestTraversal();
}
}
}
@@ -2990,7 +2995,7 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public void onUserSwitched() {
mSettingsObserver.updateSystemUiSettings();
mSettingsObserver.updateSystemUiSettings(true /* handleChange */);
synchronized (mGlobalLock) {
// force a re-application of focused window sysui visibility on each display.
mRoot.forAllDisplayPolicies(DisplayPolicy::resetSystemUiVisibilityLw);