Loading services/core/java/com/android/server/display/DisplayManagerService.java +24 −19 Original line number Diff line number Diff line Loading @@ -812,7 +812,7 @@ public final class DisplayManagerService extends SystemService { handleMinimalPostProcessingAllowedSettingChange(); if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ true); } final UserManager userManager = getUserManager(); Loading Loading @@ -868,7 +868,7 @@ public final class DisplayManagerService extends SystemService { updateHdrConversionModeSettingsLocked(); } if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ false); } } Loading Loading @@ -1237,8 +1237,11 @@ public final class DisplayManagerService extends SystemService { } if (Settings.Secure.getUriFor(MIRROR_BUILT_IN_DISPLAY).equals(uri)) { synchronized (mSyncRoot) { if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ true); } } return; } Loading @@ -1258,8 +1261,7 @@ public final class DisplayManagerService extends SystemService { 1, UserHandle.USER_CURRENT) != 0); } private void updateMirrorBuiltInDisplaySettingLocked() { synchronized (mSyncRoot) { private void updateMirrorBuiltInDisplaySettingLocked(boolean shouldSendDisplayChangeEvent) { ContentResolver resolver = mContext.getContentResolver(); final boolean mirrorBuiltInDisplay = Settings.Secure.getIntForUser(resolver, MIRROR_BUILT_IN_DISPLAY, 0, UserHandle.USER_CURRENT) != 0; Loading @@ -1268,8 +1270,10 @@ public final class DisplayManagerService extends SystemService { } mMirrorBuiltInDisplay = mirrorBuiltInDisplay; if (mFlags.isDisplayContentModeManagementEnabled()) { mLogicalDisplayMapper.forEachLocked(this::updateCanHostTasksIfNeededLocked); } mLogicalDisplayMapper.forEachLocked(logicalDisplay -> { updateCanHostTasksIfNeededLocked(logicalDisplay, shouldSendDisplayChangeEvent); }); } } Loading Loading @@ -2380,7 +2384,7 @@ public final class DisplayManagerService extends SystemService { new BrightnessPair(brightnessDefault, brightnessDefault)); if (mFlags.isDisplayContentModeManagementEnabled()) { updateCanHostTasksIfNeededLocked(display); updateCanHostTasksIfNeededLocked(display, /*shouldSendDisplayChangeEvent=*/ false); } DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); Loading Loading @@ -2703,8 +2707,9 @@ public final class DisplayManagerService extends SystemService { } } private void updateCanHostTasksIfNeededLocked(LogicalDisplay display) { if (display.setCanHostTasksLocked(!mMirrorBuiltInDisplay)) { private void updateCanHostTasksIfNeededLocked(LogicalDisplay display, boolean shouldSendDisplayChangeEvent) { if (display.setCanHostTasksLocked(!mMirrorBuiltInDisplay) && shouldSendDisplayChangeEvent) { sendDisplayEventIfEnabledLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_BASIC_CHANGED); } Loading services/core/java/com/android/server/wm/DisplayContent.java +6 −1 Original line number Diff line number Diff line Loading @@ -3263,7 +3263,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } private boolean allowContentModeSwitch() { /** * Note that we only allow displays that are able to show system decorations to use the content * mode switch; however, not all displays that are able to show system decorations are allowed * to use the content mode switch. */ boolean allowContentModeSwitch() { // The default display should always show system decorations. if (isDefaultDisplay) { return false; Loading services/core/java/com/android/server/wm/DisplayWindowSettings.java +10 −6 Original line number Diff line number Diff line Loading @@ -247,12 +247,7 @@ class DisplayWindowSettings { void setShouldShowSystemDecorsLocked(@NonNull DisplayContent dc, boolean shouldShow) { final boolean changed = (shouldShow != shouldShowSystemDecorsLocked(dc)); final DisplayInfo displayInfo = dc.getDisplayInfo(); final SettingsProvider.SettingsEntry overrideSettings = mSettingsProvider.getOverrideSettings(displayInfo); overrideSettings.mShouldShowSystemDecors = shouldShow; mSettingsProvider.updateOverrideSettings(displayInfo, overrideSettings); setShouldShowSystemDecorsInternalLocked(dc, shouldShow); if (enableDisplayContentModeManagement()) { if (dc.isDefaultDisplay || dc.isPrivate() || !changed) { Loading @@ -269,6 +264,15 @@ class DisplayWindowSettings { } } void setShouldShowSystemDecorsInternalLocked(@NonNull DisplayContent dc, boolean shouldShow) { final DisplayInfo displayInfo = dc.getDisplayInfo(); final SettingsProvider.SettingsEntry overrideSettings = mSettingsProvider.getOverrideSettings(displayInfo); overrideSettings.mShouldShowSystemDecors = shouldShow; mSettingsProvider.updateOverrideSettings(displayInfo, overrideSettings); } boolean isHomeSupportedLocked(@NonNull DisplayContent dc) { if (dc.getDisplayId() == Display.DEFAULT_DISPLAY) { // Default display should show home. Loading services/core/java/com/android/server/wm/RootWindowContainer.java +6 −0 Original line number Diff line number Diff line Loading @@ -2775,6 +2775,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return; } if (enableDisplayContentModeManagement() && display.allowContentModeSwitch()) { mWindowManager.mDisplayWindowSettings .setShouldShowSystemDecorsInternalLocked(display, display.mDisplay.canHostTasks()); } startSystemDecorations(display, "displayAdded"); // Drop any cached DisplayInfos associated with this display id - the values are now Loading Loading
services/core/java/com/android/server/display/DisplayManagerService.java +24 −19 Original line number Diff line number Diff line Loading @@ -812,7 +812,7 @@ public final class DisplayManagerService extends SystemService { handleMinimalPostProcessingAllowedSettingChange(); if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ true); } final UserManager userManager = getUserManager(); Loading Loading @@ -868,7 +868,7 @@ public final class DisplayManagerService extends SystemService { updateHdrConversionModeSettingsLocked(); } if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ false); } } Loading Loading @@ -1237,8 +1237,11 @@ public final class DisplayManagerService extends SystemService { } if (Settings.Secure.getUriFor(MIRROR_BUILT_IN_DISPLAY).equals(uri)) { synchronized (mSyncRoot) { if (mFlags.isDisplayContentModeManagementEnabled()) { updateMirrorBuiltInDisplaySettingLocked(); updateMirrorBuiltInDisplaySettingLocked(/*shouldSendDisplayChangeEvent=*/ true); } } return; } Loading @@ -1258,8 +1261,7 @@ public final class DisplayManagerService extends SystemService { 1, UserHandle.USER_CURRENT) != 0); } private void updateMirrorBuiltInDisplaySettingLocked() { synchronized (mSyncRoot) { private void updateMirrorBuiltInDisplaySettingLocked(boolean shouldSendDisplayChangeEvent) { ContentResolver resolver = mContext.getContentResolver(); final boolean mirrorBuiltInDisplay = Settings.Secure.getIntForUser(resolver, MIRROR_BUILT_IN_DISPLAY, 0, UserHandle.USER_CURRENT) != 0; Loading @@ -1268,8 +1270,10 @@ public final class DisplayManagerService extends SystemService { } mMirrorBuiltInDisplay = mirrorBuiltInDisplay; if (mFlags.isDisplayContentModeManagementEnabled()) { mLogicalDisplayMapper.forEachLocked(this::updateCanHostTasksIfNeededLocked); } mLogicalDisplayMapper.forEachLocked(logicalDisplay -> { updateCanHostTasksIfNeededLocked(logicalDisplay, shouldSendDisplayChangeEvent); }); } } Loading Loading @@ -2380,7 +2384,7 @@ public final class DisplayManagerService extends SystemService { new BrightnessPair(brightnessDefault, brightnessDefault)); if (mFlags.isDisplayContentModeManagementEnabled()) { updateCanHostTasksIfNeededLocked(display); updateCanHostTasksIfNeededLocked(display, /*shouldSendDisplayChangeEvent=*/ false); } DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); Loading Loading @@ -2703,8 +2707,9 @@ public final class DisplayManagerService extends SystemService { } } private void updateCanHostTasksIfNeededLocked(LogicalDisplay display) { if (display.setCanHostTasksLocked(!mMirrorBuiltInDisplay)) { private void updateCanHostTasksIfNeededLocked(LogicalDisplay display, boolean shouldSendDisplayChangeEvent) { if (display.setCanHostTasksLocked(!mMirrorBuiltInDisplay) && shouldSendDisplayChangeEvent) { sendDisplayEventIfEnabledLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_BASIC_CHANGED); } Loading
services/core/java/com/android/server/wm/DisplayContent.java +6 −1 Original line number Diff line number Diff line Loading @@ -3263,7 +3263,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } private boolean allowContentModeSwitch() { /** * Note that we only allow displays that are able to show system decorations to use the content * mode switch; however, not all displays that are able to show system decorations are allowed * to use the content mode switch. */ boolean allowContentModeSwitch() { // The default display should always show system decorations. if (isDefaultDisplay) { return false; Loading
services/core/java/com/android/server/wm/DisplayWindowSettings.java +10 −6 Original line number Diff line number Diff line Loading @@ -247,12 +247,7 @@ class DisplayWindowSettings { void setShouldShowSystemDecorsLocked(@NonNull DisplayContent dc, boolean shouldShow) { final boolean changed = (shouldShow != shouldShowSystemDecorsLocked(dc)); final DisplayInfo displayInfo = dc.getDisplayInfo(); final SettingsProvider.SettingsEntry overrideSettings = mSettingsProvider.getOverrideSettings(displayInfo); overrideSettings.mShouldShowSystemDecors = shouldShow; mSettingsProvider.updateOverrideSettings(displayInfo, overrideSettings); setShouldShowSystemDecorsInternalLocked(dc, shouldShow); if (enableDisplayContentModeManagement()) { if (dc.isDefaultDisplay || dc.isPrivate() || !changed) { Loading @@ -269,6 +264,15 @@ class DisplayWindowSettings { } } void setShouldShowSystemDecorsInternalLocked(@NonNull DisplayContent dc, boolean shouldShow) { final DisplayInfo displayInfo = dc.getDisplayInfo(); final SettingsProvider.SettingsEntry overrideSettings = mSettingsProvider.getOverrideSettings(displayInfo); overrideSettings.mShouldShowSystemDecors = shouldShow; mSettingsProvider.updateOverrideSettings(displayInfo, overrideSettings); } boolean isHomeSupportedLocked(@NonNull DisplayContent dc) { if (dc.getDisplayId() == Display.DEFAULT_DISPLAY) { // Default display should show home. Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +6 −0 Original line number Diff line number Diff line Loading @@ -2775,6 +2775,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return; } if (enableDisplayContentModeManagement() && display.allowContentModeSwitch()) { mWindowManager.mDisplayWindowSettings .setShouldShowSystemDecorsInternalLocked(display, display.mDisplay.canHostTasks()); } startSystemDecorations(display, "displayAdded"); // Drop any cached DisplayInfos associated with this display id - the values are now Loading