Loading core/java/android/provider/Settings.java +15 −0 Original line number Diff line number Diff line Loading @@ -7487,6 +7487,21 @@ public final class Settings { @UnsupportedAppUsage public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; /** * Whether the user allows minimal post processing or not. * * <p>Values: * 0 - Not allowed. Any preferences set through the Window.setPreferMinimalPostProcessing * API will be ignored. * 1 - Allowed. Any preferences set through the Window.setPreferMinimalPostProcessing API * will be respected and the appropriate signals will be sent to display. * (Default behaviour) * * @hide */ public static final String MINIMAL_POST_PROCESSING_ALLOWED = "minimal_post_processing_allowed"; /** * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". * @hide Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class SecureSettings { Settings.Secure.TTY_MODE_ENABLED, Settings.Secure.RTT_CALLING_MODE, Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR, Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED, Settings.Secure.NIGHT_DISPLAY_CUSTOM_START_TIME, Settings.Secure.NIGHT_DISPLAY_CUSTOM_END_TIME, Settings.Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE, Loading packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class SecureSettingsValidators { VALIDATORS.put( Secure.INCALL_POWER_BUTTON_BEHAVIOR, new DiscreteValueValidator(new String[] {"1", "2"})); VALIDATORS.put(Secure.MINIMAL_POST_PROCESSING_ALLOWED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_CUSTOM_START_TIME, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_CUSTOM_END_TIME, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE, NON_NEGATIVE_INTEGER_VALIDATOR); Loading services/core/java/com/android/server/display/DisplayManagerService.java +49 −8 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; import android.graphics.ColorSpace; import android.graphics.Point; import android.graphics.Rect; Loading @@ -60,6 +61,7 @@ import android.hardware.display.WifiDisplayStatus; import android.hardware.input.InputManagerInternal; import android.media.projection.IMediaProjection; import android.media.projection.IMediaProjectionManager; import android.net.Uri; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -77,6 +79,7 @@ import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; import android.util.IntArray; import android.util.Pair; Loading Loading @@ -304,6 +307,13 @@ public final class DisplayManagerService extends SystemService { private SensorManager mSensorManager; // Whether minimal post processing is allowed by the user. @GuardedBy("mSyncRoot") private boolean mMinimalPostProcessingAllowed; // Receives notifications about changes to Settings. private SettingsObserver mSettingsObserver; public DisplayManagerService(Context context) { this(context, new Injector()); } Loading Loading @@ -403,6 +413,7 @@ public final class DisplayManagerService extends SystemService { BrightnessConfiguration config = mPersistentDataStore.getBrightnessConfiguration(userSerial); mDisplayPowerController.setBrightnessConfiguration(config); handleSettingsChange(); } mDisplayPowerController.onSwitchUser(newUserId); } Loading @@ -428,6 +439,8 @@ public final class DisplayManagerService extends SystemService { // Just in case the top inset changed before the system was ready. At this point, any // relevant configuration should be in place. recordTopInsetLocked(mLogicalDisplays.get(Display.DEFAULT_DISPLAY)); updateSettingsLocked(); } mDisplayModeDirector.setDesiredDisplayModeSpecsListener( Loading @@ -435,6 +448,8 @@ public final class DisplayManagerService extends SystemService { mDisplayModeDirector.start(mSensorManager); mHandler.sendEmptyMessage(MSG_REGISTER_ADDITIONAL_DISPLAY_ADAPTERS); mSettingsObserver = new SettingsObserver(); } @VisibleForTesting Loading Loading @@ -569,6 +584,33 @@ public final class DisplayManagerService extends SystemService { } } private class SettingsObserver extends ContentObserver { SettingsObserver() { super(mHandler); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor( Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED), false, this); } @Override public void onChange(boolean selfChange, Uri uri) { handleSettingsChange(); } } private void handleSettingsChange() { synchronized (mSyncRoot) { updateSettingsLocked(); scheduleTraversalLocked(false); } } private void updateSettingsLocked() { mMinimalPostProcessingAllowed = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED, 1, UserHandle.USER_CURRENT) != 0; } private DisplayInfo getDisplayInfoInternal(int displayId, int callingUid) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); Loading Loading @@ -1192,7 +1234,7 @@ public final class DisplayManagerService extends SystemService { } private void setDisplayPropertiesInternal(int displayId, boolean hasContent, float requestedRefreshRate, int requestedModeId, boolean requestedMinimalPostProcessing, float requestedRefreshRate, int requestedModeId, boolean preferMinimalPostProcessing, boolean inTraversal) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); Loading Loading @@ -1220,15 +1262,14 @@ public final class DisplayManagerService extends SystemService { mDisplayModeDirector.getAppRequestObserver().setAppRequestedMode( displayId, requestedModeId); if (display.getDisplayInfoLocked().minimalPostProcessingSupported) { boolean mppRequest = mMinimalPostProcessingAllowed && preferMinimalPostProcessing; if (display.getDisplayInfoLocked().minimalPostProcessingSupported && (display.getRequestedMinimalPostProcessingLocked() != requestedMinimalPostProcessing)) { display.setRequestedMinimalPostProcessingLocked(requestedMinimalPostProcessing); if (display.getRequestedMinimalPostProcessingLocked() != mppRequest) { display.setRequestedMinimalPostProcessingLocked(mppRequest); shouldScheduleTraversal = true; } } if (shouldScheduleTraversal) { scheduleTraversalLocked(inTraversal); Loading Loading
core/java/android/provider/Settings.java +15 −0 Original line number Diff line number Diff line Loading @@ -7487,6 +7487,21 @@ public final class Settings { @UnsupportedAppUsage public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; /** * Whether the user allows minimal post processing or not. * * <p>Values: * 0 - Not allowed. Any preferences set through the Window.setPreferMinimalPostProcessing * API will be ignored. * 1 - Allowed. Any preferences set through the Window.setPreferMinimalPostProcessing API * will be respected and the appropriate signals will be sent to display. * (Default behaviour) * * @hide */ public static final String MINIMAL_POST_PROCESSING_ALLOWED = "minimal_post_processing_allowed"; /** * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". * @hide Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class SecureSettings { Settings.Secure.TTY_MODE_ENABLED, Settings.Secure.RTT_CALLING_MODE, Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR, Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED, Settings.Secure.NIGHT_DISPLAY_CUSTOM_START_TIME, Settings.Secure.NIGHT_DISPLAY_CUSTOM_END_TIME, Settings.Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE, Loading
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class SecureSettingsValidators { VALIDATORS.put( Secure.INCALL_POWER_BUTTON_BEHAVIOR, new DiscreteValueValidator(new String[] {"1", "2"})); VALIDATORS.put(Secure.MINIMAL_POST_PROCESSING_ALLOWED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_CUSTOM_START_TIME, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_CUSTOM_END_TIME, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE, NON_NEGATIVE_INTEGER_VALIDATOR); Loading
services/core/java/com/android/server/display/DisplayManagerService.java +49 −8 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; import android.graphics.ColorSpace; import android.graphics.Point; import android.graphics.Rect; Loading @@ -60,6 +61,7 @@ import android.hardware.display.WifiDisplayStatus; import android.hardware.input.InputManagerInternal; import android.media.projection.IMediaProjection; import android.media.projection.IMediaProjectionManager; import android.net.Uri; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -77,6 +79,7 @@ import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; import android.util.IntArray; import android.util.Pair; Loading Loading @@ -304,6 +307,13 @@ public final class DisplayManagerService extends SystemService { private SensorManager mSensorManager; // Whether minimal post processing is allowed by the user. @GuardedBy("mSyncRoot") private boolean mMinimalPostProcessingAllowed; // Receives notifications about changes to Settings. private SettingsObserver mSettingsObserver; public DisplayManagerService(Context context) { this(context, new Injector()); } Loading Loading @@ -403,6 +413,7 @@ public final class DisplayManagerService extends SystemService { BrightnessConfiguration config = mPersistentDataStore.getBrightnessConfiguration(userSerial); mDisplayPowerController.setBrightnessConfiguration(config); handleSettingsChange(); } mDisplayPowerController.onSwitchUser(newUserId); } Loading @@ -428,6 +439,8 @@ public final class DisplayManagerService extends SystemService { // Just in case the top inset changed before the system was ready. At this point, any // relevant configuration should be in place. recordTopInsetLocked(mLogicalDisplays.get(Display.DEFAULT_DISPLAY)); updateSettingsLocked(); } mDisplayModeDirector.setDesiredDisplayModeSpecsListener( Loading @@ -435,6 +448,8 @@ public final class DisplayManagerService extends SystemService { mDisplayModeDirector.start(mSensorManager); mHandler.sendEmptyMessage(MSG_REGISTER_ADDITIONAL_DISPLAY_ADAPTERS); mSettingsObserver = new SettingsObserver(); } @VisibleForTesting Loading Loading @@ -569,6 +584,33 @@ public final class DisplayManagerService extends SystemService { } } private class SettingsObserver extends ContentObserver { SettingsObserver() { super(mHandler); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor( Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED), false, this); } @Override public void onChange(boolean selfChange, Uri uri) { handleSettingsChange(); } } private void handleSettingsChange() { synchronized (mSyncRoot) { updateSettingsLocked(); scheduleTraversalLocked(false); } } private void updateSettingsLocked() { mMinimalPostProcessingAllowed = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED, 1, UserHandle.USER_CURRENT) != 0; } private DisplayInfo getDisplayInfoInternal(int displayId, int callingUid) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); Loading Loading @@ -1192,7 +1234,7 @@ public final class DisplayManagerService extends SystemService { } private void setDisplayPropertiesInternal(int displayId, boolean hasContent, float requestedRefreshRate, int requestedModeId, boolean requestedMinimalPostProcessing, float requestedRefreshRate, int requestedModeId, boolean preferMinimalPostProcessing, boolean inTraversal) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); Loading Loading @@ -1220,15 +1262,14 @@ public final class DisplayManagerService extends SystemService { mDisplayModeDirector.getAppRequestObserver().setAppRequestedMode( displayId, requestedModeId); if (display.getDisplayInfoLocked().minimalPostProcessingSupported) { boolean mppRequest = mMinimalPostProcessingAllowed && preferMinimalPostProcessing; if (display.getDisplayInfoLocked().minimalPostProcessingSupported && (display.getRequestedMinimalPostProcessingLocked() != requestedMinimalPostProcessing)) { display.setRequestedMinimalPostProcessingLocked(requestedMinimalPostProcessing); if (display.getRequestedMinimalPostProcessingLocked() != mppRequest) { display.setRequestedMinimalPostProcessingLocked(mppRequest); shouldScheduleTraversal = true; } } if (shouldScheduleTraversal) { scheduleTraversalLocked(inTraversal); Loading