Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a19e45b authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "Add flag for match content frame rate"

parents d0fb8ca8 99aa6e7f
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -7760,6 +7760,21 @@ public final class Settings {
        public static final String MINIMAL_POST_PROCESSING_ALLOWED =
                "minimal_post_processing_allowed";
        /**
         * User's preference for refresh rate switching.
         *
         * <p>Values:
         * 0 - Never switch refresh rates.
         * 1 - Switch refresh rates only when it can be done seamlessly. (Default behaviour)
         * 2 - Always prefer refresh rate switching even if it's going to have visual interruptions
         *     for the user.
         *
         * @see android.view.Surface#setFrameRate
         * @hide
         */
        public static final String MATCH_CONTENT_FRAME_RATE =
                "match_content_frame_rate";
        /**
         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
         * @hide
@@ -10708,7 +10723,7 @@ public final class Settings {
         *    0 = Disabled
         *    1 = Enabled
         *
         * Most readers of this setting should simply check if value == 1 to determined the
         * Most readers of this setting should simply check if value == 1 to determine the
         * enabled state.
         * @hide
         * @deprecated To be removed.
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class SecureSettings {
        Settings.Secure.RTT_CALLING_MODE,
        Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
        Settings.Secure.MINIMAL_POST_PROCESSING_ALLOWED,
        Settings.Secure.MATCH_CONTENT_FRAME_RATE,
        Settings.Secure.NIGHT_DISPLAY_CUSTOM_START_TIME,
        Settings.Secure.NIGHT_DISPLAY_CUSTOM_END_TIME,
        Settings.Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE,
+3 −0
Original line number Diff line number Diff line
@@ -135,6 +135,9 @@ public class SecureSettingsValidators {
                Secure.INCALL_POWER_BUTTON_BEHAVIOR,
                new DiscreteValueValidator(new String[] {"1", "2"}));
        VALIDATORS.put(Secure.MINIMAL_POST_PROCESSING_ALLOWED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(
                Secure.MATCH_CONTENT_FRAME_RATE,
                new DiscreteValueValidator(new String[] {"0", "1", "2"}));
        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);
+18 −0
Original line number Diff line number Diff line
@@ -931,6 +931,8 @@ public class DisplayModeDirector {
                Settings.System.getUriFor(Settings.System.MIN_REFRESH_RATE);
        private final Uri mLowPowerModeSetting =
                Settings.Global.getUriFor(Settings.Global.LOW_POWER_MODE);
        private final Uri mMatchContentFrameRateSetting =
                Settings.Secure.getUriFor(Settings.Secure.MATCH_CONTENT_FRAME_RATE);

        private final Context mContext;
        private float mDefaultPeakRefreshRate;
@@ -953,6 +955,8 @@ public class DisplayModeDirector {
                    UserHandle.USER_SYSTEM);
            cr.registerContentObserver(mLowPowerModeSetting, false /*notifyDescendants*/, this,
                    UserHandle.USER_SYSTEM);
            cr.registerContentObserver(mMatchContentFrameRateSetting, false /*notifyDescendants*/,
                    this);

            Float deviceConfigDefaultPeakRefresh =
                    mDeviceConfigDisplaySettings.getDefaultPeakRefreshRate();
@@ -963,6 +967,7 @@ public class DisplayModeDirector {
            synchronized (mLock) {
                updateRefreshRateSettingLocked();
                updateLowPowerModeSettingLocked();
                updateModeSwitchingTypeSettingLocked();
            }
        }

@@ -988,6 +993,8 @@ public class DisplayModeDirector {
                    updateRefreshRateSettingLocked();
                } else if (mLowPowerModeSetting.equals(uri)) {
                    updateLowPowerModeSettingLocked();
                } else if (mMatchContentFrameRateSetting.equals(uri)) {
                    updateModeSwitchingTypeSettingLocked();
                }
            }
        }
@@ -1050,6 +1057,17 @@ public class DisplayModeDirector {
            mBrightnessObserver.onRefreshRateSettingChangedLocked(minRefreshRate, maxRefreshRate);
        }

        private void updateModeSwitchingTypeSettingLocked() {
            final ContentResolver cr = mContext.getContentResolver();
            int switchingType = Settings.Secure.getIntForUser(
                    cr, Settings.Secure.MATCH_CONTENT_FRAME_RATE, mModeSwitchingType /*default*/,
                    cr.getUserId());
            if (switchingType != mModeSwitchingType) {
                mModeSwitchingType = switchingType;
                notifyDesiredDisplayModeSpecsChangedLocked();
            }
        }

        public void dumpLocked(PrintWriter pw) {
            pw.println("  SettingsObserver");
            pw.println("    mDefaultRefreshRate: " + mDefaultRefreshRate);