Loading core/java/android/hardware/display/DisplayManagerInternal.java +10 −0 Original line number Diff line number Diff line Loading @@ -460,6 +460,16 @@ public abstract class DisplayManagerInternal { */ public abstract void stylusGestureStarted(long eventTime); /** * Called by {@link com.android.server.wm.ContentRecorder} to verify whether * the display is allowed to mirror primary display's content. * @param displayId the id of the display where we mirror to. * @return true if the mirroring dialog is confirmed (display is enabled), or * {@link com.android.server.display.ExternalDisplayPolicy#ENABLE_ON_CONNECT} * system property is enabled. */ public abstract boolean isDisplayReadyForMirroring(int displayId); /** * Describes the requested power state of the display. * Loading services/core/java/com/android/server/display/DisplayManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -5666,6 +5666,11 @@ public final class DisplayManagerService extends SystemService { displayPowerController.stylusGestureStarted(eventTime); } } @Override public boolean isDisplayReadyForMirroring(int displayId) { return mExternalDisplayPolicy.isDisplayReadyForMirroring(displayId); } } class DesiredDisplayModeSpecsObserver Loading services/core/java/com/android/server/display/ExternalDisplayPolicy.java +48 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,54 @@ class ExternalDisplayPolicy { } } boolean isDisplayReadyForMirroring(int displayId) { if (!mFlags.isWaitingConfirmationBeforeMirroringEnabled()) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring CONFIRMED - " + " flag 'waiting for confirmation before mirroring' is disabled"); } return true; } synchronized (mSyncRoot) { if (!mIsBootCompleted) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "boot is in progress"); } return false; } var logicalDisplay = mLogicalDisplayMapper.getDisplayLocked(displayId); if (logicalDisplay == null) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay is null"); } return false; } if (!isExternalDisplayLocked(logicalDisplay)) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay" + logicalDisplay.getDisplayIdLocked() + " type is " + logicalDisplay.getDisplayInfoLocked().type); } return false; } if (!logicalDisplay.isEnabledLocked()) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay is disabled"); } return false; } } return true; } private final class SkinThermalStatusObserver extends IThermalEventListener.Stub { @Override public void notifyThrottling(@NonNull final Temperature temp) { Loading services/core/java/com/android/server/display/feature/DisplayManagerFlags.java +14 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ public class DisplayManagerFlags { Flags::enableUserRefreshRateForExternalDisplay ); private final FlagState mEnableWaitingConfirmationBeforeMirroring = new FlagState( Flags.FLAG_ENABLE_WAITING_CONFIRMATION_BEFORE_MIRRORING, Flags::enableWaitingConfirmationBeforeMirroring ); private final FlagState mEnableBatteryStatsForAllDisplays = new FlagState( Flags.FLAG_ENABLE_BATTERY_STATS_FOR_ALL_DISPLAYS, Flags::enableBatteryStatsForAllDisplays Loading Loading @@ -444,6 +449,14 @@ public class DisplayManagerFlags { return mIdleScreenConfigInSubscribingLightSensor.isEnabled(); } /** * @return {@code true} if mirroring won't be enabled until boot completes and the user enables * the display. */ public boolean isWaitingConfirmationBeforeMirroringEnabled() { return mEnableWaitingConfirmationBeforeMirroring.isEnabled(); } /** * @return {@code true} if battery stats is enabled for all displays, not just the primary * display. Loading Loading @@ -511,6 +524,7 @@ public class DisplayManagerFlags { pw.println(" " + mVirtualDisplayLimit); pw.println(" " + mNormalBrightnessForDozeParameter); pw.println(" " + mIdleScreenConfigInSubscribingLightSensor); pw.println(" " + mEnableWaitingConfirmationBeforeMirroring); pw.println(" " + mEnableBatteryStatsForAllDisplays); pw.println(" " + mBlockAutobrightnessChangesOnStylusUsage); pw.println(" " + mIsUserRefreshRateForExternalDisplayEnabled); Loading services/core/java/com/android/server/display/feature/display_flags.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,17 @@ flag { } } flag { name: "enable_waiting_confirmation_before_mirroring" namespace: "display_manager" description: "Allow ContentRecorder checking whether user confirmed mirroring after boot" bug: "361698995" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "enable_battery_stats_for_all_displays" namespace: "display_manager" Loading Loading
core/java/android/hardware/display/DisplayManagerInternal.java +10 −0 Original line number Diff line number Diff line Loading @@ -460,6 +460,16 @@ public abstract class DisplayManagerInternal { */ public abstract void stylusGestureStarted(long eventTime); /** * Called by {@link com.android.server.wm.ContentRecorder} to verify whether * the display is allowed to mirror primary display's content. * @param displayId the id of the display where we mirror to. * @return true if the mirroring dialog is confirmed (display is enabled), or * {@link com.android.server.display.ExternalDisplayPolicy#ENABLE_ON_CONNECT} * system property is enabled. */ public abstract boolean isDisplayReadyForMirroring(int displayId); /** * Describes the requested power state of the display. * Loading
services/core/java/com/android/server/display/DisplayManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -5666,6 +5666,11 @@ public final class DisplayManagerService extends SystemService { displayPowerController.stylusGestureStarted(eventTime); } } @Override public boolean isDisplayReadyForMirroring(int displayId) { return mExternalDisplayPolicy.isDisplayReadyForMirroring(displayId); } } class DesiredDisplayModeSpecsObserver Loading
services/core/java/com/android/server/display/ExternalDisplayPolicy.java +48 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,54 @@ class ExternalDisplayPolicy { } } boolean isDisplayReadyForMirroring(int displayId) { if (!mFlags.isWaitingConfirmationBeforeMirroringEnabled()) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring CONFIRMED - " + " flag 'waiting for confirmation before mirroring' is disabled"); } return true; } synchronized (mSyncRoot) { if (!mIsBootCompleted) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "boot is in progress"); } return false; } var logicalDisplay = mLogicalDisplayMapper.getDisplayLocked(displayId); if (logicalDisplay == null) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay is null"); } return false; } if (!isExternalDisplayLocked(logicalDisplay)) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay" + logicalDisplay.getDisplayIdLocked() + " type is " + logicalDisplay.getDisplayInfoLocked().type); } return false; } if (!logicalDisplay.isEnabledLocked()) { if (DEBUG) { Slog.d(TAG, "isDisplayReadyForMirroring: mirroring is not confirmed - " + "logicalDisplay is disabled"); } return false; } } return true; } private final class SkinThermalStatusObserver extends IThermalEventListener.Stub { @Override public void notifyThrottling(@NonNull final Temperature temp) { Loading
services/core/java/com/android/server/display/feature/DisplayManagerFlags.java +14 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ public class DisplayManagerFlags { Flags::enableUserRefreshRateForExternalDisplay ); private final FlagState mEnableWaitingConfirmationBeforeMirroring = new FlagState( Flags.FLAG_ENABLE_WAITING_CONFIRMATION_BEFORE_MIRRORING, Flags::enableWaitingConfirmationBeforeMirroring ); private final FlagState mEnableBatteryStatsForAllDisplays = new FlagState( Flags.FLAG_ENABLE_BATTERY_STATS_FOR_ALL_DISPLAYS, Flags::enableBatteryStatsForAllDisplays Loading Loading @@ -444,6 +449,14 @@ public class DisplayManagerFlags { return mIdleScreenConfigInSubscribingLightSensor.isEnabled(); } /** * @return {@code true} if mirroring won't be enabled until boot completes and the user enables * the display. */ public boolean isWaitingConfirmationBeforeMirroringEnabled() { return mEnableWaitingConfirmationBeforeMirroring.isEnabled(); } /** * @return {@code true} if battery stats is enabled for all displays, not just the primary * display. Loading Loading @@ -511,6 +524,7 @@ public class DisplayManagerFlags { pw.println(" " + mVirtualDisplayLimit); pw.println(" " + mNormalBrightnessForDozeParameter); pw.println(" " + mIdleScreenConfigInSubscribingLightSensor); pw.println(" " + mEnableWaitingConfirmationBeforeMirroring); pw.println(" " + mEnableBatteryStatsForAllDisplays); pw.println(" " + mBlockAutobrightnessChangesOnStylusUsage); pw.println(" " + mIsUserRefreshRateForExternalDisplayEnabled); Loading
services/core/java/com/android/server/display/feature/display_flags.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,17 @@ flag { } } flag { name: "enable_waiting_confirmation_before_mirroring" namespace: "display_manager" description: "Allow ContentRecorder checking whether user confirmed mirroring after boot" bug: "361698995" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "enable_battery_stats_for_all_displays" namespace: "display_manager" Loading