Loading core/api/current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -1893,6 +1893,7 @@ package android { field public static final int windowFullscreen = 16843277; // 0x101020d field public static final int windowHideAnimation = 16842935; // 0x10100b7 field public static final int windowIsFloating = 16842839; // 0x1010057 field @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public static final int windowIsFrameRatePowerSavingsBalanced; field public static final int windowIsTranslucent = 16842840; // 0x1010058 field public static final int windowLayoutAffinity = 16844313; // 0x1010619 field public static final int windowLayoutInDisplayCutoutMode = 16844166; // 0x1010586 Loading Loading @@ -54081,6 +54082,7 @@ package android.view { method public abstract void invalidatePanelMenu(int); method public final boolean isActive(); method public abstract boolean isFloating(); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean isFrameRatePowerSavingsBalanced(); method public boolean isNavigationBarContrastEnforced(); method public abstract boolean isShortcutKey(int, android.view.KeyEvent); method @Deprecated public boolean isStatusBarContrastEnforced(); Loading Loading @@ -54130,6 +54132,7 @@ package android.view { method public void setFlags(int, int); method public void setFormat(int); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRateBoostOnTouchEnabled(boolean); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRatePowerSavingsBalanced(boolean); method public void setGravity(int); method @RequiresPermission(android.Manifest.permission.HIDE_OVERLAY_WINDOWS) public final void setHideOverlayWindows(boolean); method public void setIcon(@DrawableRes int); Loading Loading @@ -54501,6 +54504,7 @@ package android.view { method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean getFrameRateBoostOnTouchEnabled(); method public final CharSequence getTitle(); method public boolean isFitInsetsIgnoringVisibility(); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean isFrameRatePowerSavingsBalanced(); method public boolean isHdrConversionEnabled(); method public static boolean mayUseInputMethod(int); method public void setBlurBehindRadius(@IntRange(from=0) int); Loading @@ -54511,6 +54515,7 @@ package android.view { method public void setFitInsetsSides(int); method public void setFitInsetsTypes(int); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRateBoostOnTouchEnabled(boolean); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRatePowerSavingsBalanced(boolean); method public void setHdrConversionEnabled(boolean); method public final void setTitle(CharSequence); method public void setWallpaperTouchEventsEnabled(boolean); core/java/android/view/ViewRootImpl.java +37 −7 Original line number Diff line number Diff line Loading @@ -1022,6 +1022,11 @@ public final class ViewRootImpl implements ViewParent, // Used to check if there is a message in the message queue // for idleness handling. private boolean mHasIdledMessage = false; // Used to allow developers to opt out Toolkit dVRR feature. // This feature allows device to adjust refresh rate // as needed and can be useful for power saving. // Should not enable the dVRR feature if the value is false. private boolean mIsFrameRatePowerSavingsBalanced = true; // time for touch boost period. private static final int FRAME_RATE_TOUCH_BOOST_TIME = 3000; // time for checking idle status periodically. Loading Loading @@ -2533,8 +2538,10 @@ public final class ViewRootImpl implements ViewParent, // Set the frame rate selection strategy to FRAME_RATE_SELECTION_STRATEGY_SELF // This strategy ensures that the frame rate specifications do not cascade down to // the descendant layers. This is particularly important for applications like Chrome, // where child surfaces should adhere to default behavior instead of no preference if (sToolkitSetFrameRateReadOnlyFlagValue) { // where child surfaces should adhere to default behavior instead of no preference. // This issue only happens when ViewRootImpl calls setFrameRateCategory. This is // no longer needed if the dVRR feature is disabled. if (shouldEnableDvrr()) { try { mFrameRateTransaction.setFrameRateSelectionStrategy(sc, sc.FRAME_RATE_SELECTION_STRATEGY_SELF).applyAsyncUnsafe(); Loading Loading @@ -3258,7 +3265,7 @@ public final class ViewRootImpl implements ViewParent, destroyHardwareResources(); } if (sToolkitSetFrameRateReadOnlyFlagValue && viewVisibility == View.VISIBLE) { if (shouldEnableDvrr() && viewVisibility == View.VISIBLE) { // Boost frame rate when the viewVisibility becomes true. // This is mainly for lanuchers that lanuch new windows. boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME); Loading Loading @@ -3973,7 +3980,7 @@ public final class ViewRootImpl implements ViewParent, } } if (sToolkitSetFrameRateReadOnlyFlagValue) { if (shouldEnableDvrr()) { // Boost the frame rate when the ViewRootImpl first becomes available. boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME); } Loading Loading @@ -12343,12 +12350,12 @@ public final class ViewRootImpl implements ViewParent, private boolean shouldSetFrameRateCategory() { // use toolkitSetFrameRate flag to gate the change return mSurface.isValid() && sToolkitSetFrameRateReadOnlyFlagValue; return mSurface.isValid() && shouldEnableDvrr(); } private boolean shouldSetFrameRate() { // use toolkitSetFrameRate flag to gate the change return sToolkitSetFrameRateReadOnlyFlagValue; return mSurface.isValid() && mPreferredFrameRate > 0 && shouldEnableDvrr(); } private boolean shouldTouchBoost(int motionEventAction, int windowType) { Loading @@ -12357,7 +12364,7 @@ public final class ViewRootImpl implements ViewParent, || motionEventAction == MotionEvent.ACTION_UP; boolean undesiredType = windowType == TYPE_INPUT_METHOD && mShouldSuppressBoostOnTyping; // use toolkitSetFrameRate flag to gate the change return desiredAction && !undesiredType && sToolkitSetFrameRateReadOnlyFlagValue return desiredAction && !undesiredType && shouldEnableDvrr() && getFrameRateBoostOnTouchEnabled(); } Loading Loading @@ -12479,4 +12486,27 @@ public final class ViewRootImpl implements ViewParent, // Record the largest view of percentage to the display size. mLargestChildPercentage = Math.max(percentage, mLargestChildPercentage); } /** * Get the value of mIsFrameRatePowerSavingsBalanced * Can be used to checked if toolkit dVRR feature is enabled. The default value is true. */ @VisibleForTesting public boolean isFrameRatePowerSavingsBalanced() { return mIsFrameRatePowerSavingsBalanced; } /** * Set the value of mIsFrameRatePowerSavingsBalanced * Can be used to checked if toolkit dVRR feature is enabled. */ public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { mIsFrameRatePowerSavingsBalanced = enabled; } } private boolean shouldEnableDvrr() { return sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced; } } core/java/android/view/Window.java +36 −0 Original line number Diff line number Diff line Loading @@ -1408,6 +1408,42 @@ public abstract class Window { return true; } /** * Set whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * * @param enabled whether the frameratepowersavingsbalance is enabled. * @see #isFrameRatePowerSavingsBalanced() * @see WindowManager.LayoutParams#setFrameRatePowerSavingsBalanced(boolean) */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.setFrameRatePowerSavingsBalanced(enabled); dispatchWindowAttributesChanged(attrs); } } /** * Get whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * {@link #setFrameRateBoostOnTouchEnabled(boolean)} * * @return whether the frameratepowersavingsbalance is enabled. * @see #setFrameRatePowerSavingsBalanced(boolean) * @see WindowManager.LayoutParams#isFrameRatePowerSavingsBalanced() */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public boolean isFrameRatePowerSavingsBalanced() { if (sToolkitSetFrameRateReadOnlyFlagValue) { return getAttributes().isFrameRatePowerSavingsBalanced(); } return false; } /** * If {@code isPreferred} is true, this method requests that the connected display does minimal * post processing when this window is visible on the screen. Otherwise, it requests that the Loading core/java/android/view/WindowManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -4439,6 +4439,7 @@ public interface WindowManager extends ViewManager { * For variable refresh rate project. */ private boolean mFrameRateBoostOnTouch = true; private boolean mIsFrameRatePowerSavingsBalanced = true; private static boolean sToolkitSetFrameRateReadOnlyFlagValue = android.view.flags.Flags.toolkitSetFrameRateReadOnly(); Loading Loading @@ -4902,6 +4903,36 @@ public interface WindowManager extends ViewManager { return true; } /** * Set the value whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * * @param enabled Whether we should enable frameratepowersavingsbalance. */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { mIsFrameRatePowerSavingsBalanced = enabled; } } /** * Get the value whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * by {@link #setFrameRatePowerSavingsBalanced(boolean)} * * @return Whether we should enable frameratepowersavingsbalance. */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public boolean isFrameRatePowerSavingsBalanced() { if (sToolkitSetFrameRateReadOnlyFlagValue) { return mIsFrameRatePowerSavingsBalanced; } return true; } /** * <p> * Blurs the screen behind the window. The effect is similar to that of {@link #dimAmount}, Loading Loading @@ -5055,6 +5086,7 @@ public interface WindowManager extends ViewManager { out.writeFloat(mDesiredHdrHeadroom); if (sToolkitSetFrameRateReadOnlyFlagValue) { out.writeBoolean(mFrameRateBoostOnTouch); out.writeBoolean(mIsFrameRatePowerSavingsBalanced); } } Loading Loading @@ -5130,6 +5162,7 @@ public interface WindowManager extends ViewManager { mDesiredHdrHeadroom = in.readFloat(); if (sToolkitSetFrameRateReadOnlyFlagValue) { mFrameRateBoostOnTouch = in.readBoolean(); mIsFrameRatePowerSavingsBalanced = in.readBoolean(); } } Loading Loading @@ -5473,6 +5506,12 @@ public interface WindowManager extends ViewManager { changes |= LAYOUT_CHANGED; } if (sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced != o.mIsFrameRatePowerSavingsBalanced) { mIsFrameRatePowerSavingsBalanced = o.mIsFrameRatePowerSavingsBalanced; changes |= LAYOUT_CHANGED; } return changes; } Loading Loading @@ -5700,6 +5739,11 @@ public interface WindowManager extends ViewManager { sb.append(prefix).append(" frameRateBoostOnTouch="); sb.append(mFrameRateBoostOnTouch); } if (sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced) { sb.append(System.lineSeparator()); sb.append(prefix).append(" dvrrWindowFrameRateHint="); sb.append(mIsFrameRatePowerSavingsBalanced); } if (paramsForRotation != null && paramsForRotation.length != 0) { sb.append(System.lineSeparator()); sb.append(prefix).append(" paramsForRotation:"); Loading core/java/com/android/internal/policy/PhoneWindow.java +7 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private boolean mUseDecorContext = false; private boolean mIsFrameRatePowerSavingsBalanced = true; /** @see ViewRootImpl#mActivityConfigCallback */ private ActivityConfigCallback mActivityConfigCallback; Loading Loading @@ -2211,6 +2213,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { void onViewRootImplSet(ViewRootImpl viewRoot) { viewRoot.setActivityConfigCallback(mActivityConfigCallback); viewRoot.getOnBackInvokedDispatcher().updateContext(getContext()); viewRoot.setFrameRatePowerSavingsBalanced(mIsFrameRatePowerSavingsBalanced); mProxyOnBackInvokedDispatcher.setActualDispatcher(viewRoot.getOnBackInvokedDispatcher()); applyDecorFitsSystemWindows(); } Loading Loading @@ -2559,6 +2562,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (a.getBoolean(R.styleable.Window_windowActivityTransitions, false)) { requestFeature(FEATURE_ACTIVITY_TRANSITIONS); } if (a.hasValue(R.styleable.Window_windowIsFrameRatePowerSavingsBalanced)) { mIsFrameRatePowerSavingsBalanced = a.getBoolean(R.styleable.Window_windowIsFrameRatePowerSavingsBalanced, true); } mIsTranslucent = a.getBoolean(R.styleable.Window_windowIsTranslucent, false); Loading Loading
core/api/current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -1893,6 +1893,7 @@ package android { field public static final int windowFullscreen = 16843277; // 0x101020d field public static final int windowHideAnimation = 16842935; // 0x10100b7 field public static final int windowIsFloating = 16842839; // 0x1010057 field @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public static final int windowIsFrameRatePowerSavingsBalanced; field public static final int windowIsTranslucent = 16842840; // 0x1010058 field public static final int windowLayoutAffinity = 16844313; // 0x1010619 field public static final int windowLayoutInDisplayCutoutMode = 16844166; // 0x1010586 Loading Loading @@ -54081,6 +54082,7 @@ package android.view { method public abstract void invalidatePanelMenu(int); method public final boolean isActive(); method public abstract boolean isFloating(); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean isFrameRatePowerSavingsBalanced(); method public boolean isNavigationBarContrastEnforced(); method public abstract boolean isShortcutKey(int, android.view.KeyEvent); method @Deprecated public boolean isStatusBarContrastEnforced(); Loading Loading @@ -54130,6 +54132,7 @@ package android.view { method public void setFlags(int, int); method public void setFormat(int); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRateBoostOnTouchEnabled(boolean); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRatePowerSavingsBalanced(boolean); method public void setGravity(int); method @RequiresPermission(android.Manifest.permission.HIDE_OVERLAY_WINDOWS) public final void setHideOverlayWindows(boolean); method public void setIcon(@DrawableRes int); Loading Loading @@ -54501,6 +54504,7 @@ package android.view { method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean getFrameRateBoostOnTouchEnabled(); method public final CharSequence getTitle(); method public boolean isFitInsetsIgnoringVisibility(); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public boolean isFrameRatePowerSavingsBalanced(); method public boolean isHdrConversionEnabled(); method public static boolean mayUseInputMethod(int); method public void setBlurBehindRadius(@IntRange(from=0) int); Loading @@ -54511,6 +54515,7 @@ package android.view { method public void setFitInsetsSides(int); method public void setFitInsetsTypes(int); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRateBoostOnTouchEnabled(boolean); method @FlaggedApi("android.view.flags.toolkit_set_frame_rate_read_only") public void setFrameRatePowerSavingsBalanced(boolean); method public void setHdrConversionEnabled(boolean); method public final void setTitle(CharSequence); method public void setWallpaperTouchEventsEnabled(boolean);
core/java/android/view/ViewRootImpl.java +37 −7 Original line number Diff line number Diff line Loading @@ -1022,6 +1022,11 @@ public final class ViewRootImpl implements ViewParent, // Used to check if there is a message in the message queue // for idleness handling. private boolean mHasIdledMessage = false; // Used to allow developers to opt out Toolkit dVRR feature. // This feature allows device to adjust refresh rate // as needed and can be useful for power saving. // Should not enable the dVRR feature if the value is false. private boolean mIsFrameRatePowerSavingsBalanced = true; // time for touch boost period. private static final int FRAME_RATE_TOUCH_BOOST_TIME = 3000; // time for checking idle status periodically. Loading Loading @@ -2533,8 +2538,10 @@ public final class ViewRootImpl implements ViewParent, // Set the frame rate selection strategy to FRAME_RATE_SELECTION_STRATEGY_SELF // This strategy ensures that the frame rate specifications do not cascade down to // the descendant layers. This is particularly important for applications like Chrome, // where child surfaces should adhere to default behavior instead of no preference if (sToolkitSetFrameRateReadOnlyFlagValue) { // where child surfaces should adhere to default behavior instead of no preference. // This issue only happens when ViewRootImpl calls setFrameRateCategory. This is // no longer needed if the dVRR feature is disabled. if (shouldEnableDvrr()) { try { mFrameRateTransaction.setFrameRateSelectionStrategy(sc, sc.FRAME_RATE_SELECTION_STRATEGY_SELF).applyAsyncUnsafe(); Loading Loading @@ -3258,7 +3265,7 @@ public final class ViewRootImpl implements ViewParent, destroyHardwareResources(); } if (sToolkitSetFrameRateReadOnlyFlagValue && viewVisibility == View.VISIBLE) { if (shouldEnableDvrr() && viewVisibility == View.VISIBLE) { // Boost frame rate when the viewVisibility becomes true. // This is mainly for lanuchers that lanuch new windows. boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME); Loading Loading @@ -3973,7 +3980,7 @@ public final class ViewRootImpl implements ViewParent, } } if (sToolkitSetFrameRateReadOnlyFlagValue) { if (shouldEnableDvrr()) { // Boost the frame rate when the ViewRootImpl first becomes available. boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME); } Loading Loading @@ -12343,12 +12350,12 @@ public final class ViewRootImpl implements ViewParent, private boolean shouldSetFrameRateCategory() { // use toolkitSetFrameRate flag to gate the change return mSurface.isValid() && sToolkitSetFrameRateReadOnlyFlagValue; return mSurface.isValid() && shouldEnableDvrr(); } private boolean shouldSetFrameRate() { // use toolkitSetFrameRate flag to gate the change return sToolkitSetFrameRateReadOnlyFlagValue; return mSurface.isValid() && mPreferredFrameRate > 0 && shouldEnableDvrr(); } private boolean shouldTouchBoost(int motionEventAction, int windowType) { Loading @@ -12357,7 +12364,7 @@ public final class ViewRootImpl implements ViewParent, || motionEventAction == MotionEvent.ACTION_UP; boolean undesiredType = windowType == TYPE_INPUT_METHOD && mShouldSuppressBoostOnTyping; // use toolkitSetFrameRate flag to gate the change return desiredAction && !undesiredType && sToolkitSetFrameRateReadOnlyFlagValue return desiredAction && !undesiredType && shouldEnableDvrr() && getFrameRateBoostOnTouchEnabled(); } Loading Loading @@ -12479,4 +12486,27 @@ public final class ViewRootImpl implements ViewParent, // Record the largest view of percentage to the display size. mLargestChildPercentage = Math.max(percentage, mLargestChildPercentage); } /** * Get the value of mIsFrameRatePowerSavingsBalanced * Can be used to checked if toolkit dVRR feature is enabled. The default value is true. */ @VisibleForTesting public boolean isFrameRatePowerSavingsBalanced() { return mIsFrameRatePowerSavingsBalanced; } /** * Set the value of mIsFrameRatePowerSavingsBalanced * Can be used to checked if toolkit dVRR feature is enabled. */ public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { mIsFrameRatePowerSavingsBalanced = enabled; } } private boolean shouldEnableDvrr() { return sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced; } }
core/java/android/view/Window.java +36 −0 Original line number Diff line number Diff line Loading @@ -1408,6 +1408,42 @@ public abstract class Window { return true; } /** * Set whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * * @param enabled whether the frameratepowersavingsbalance is enabled. * @see #isFrameRatePowerSavingsBalanced() * @see WindowManager.LayoutParams#setFrameRatePowerSavingsBalanced(boolean) */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.setFrameRatePowerSavingsBalanced(enabled); dispatchWindowAttributesChanged(attrs); } } /** * Get whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * {@link #setFrameRateBoostOnTouchEnabled(boolean)} * * @return whether the frameratepowersavingsbalance is enabled. * @see #setFrameRatePowerSavingsBalanced(boolean) * @see WindowManager.LayoutParams#isFrameRatePowerSavingsBalanced() */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public boolean isFrameRatePowerSavingsBalanced() { if (sToolkitSetFrameRateReadOnlyFlagValue) { return getAttributes().isFrameRatePowerSavingsBalanced(); } return false; } /** * If {@code isPreferred} is true, this method requests that the connected display does minimal * post processing when this window is visible on the screen. Otherwise, it requests that the Loading
core/java/android/view/WindowManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -4439,6 +4439,7 @@ public interface WindowManager extends ViewManager { * For variable refresh rate project. */ private boolean mFrameRateBoostOnTouch = true; private boolean mIsFrameRatePowerSavingsBalanced = true; private static boolean sToolkitSetFrameRateReadOnlyFlagValue = android.view.flags.Flags.toolkitSetFrameRateReadOnly(); Loading Loading @@ -4902,6 +4903,36 @@ public interface WindowManager extends ViewManager { return true; } /** * Set the value whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * * @param enabled Whether we should enable frameratepowersavingsbalance. */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public void setFrameRatePowerSavingsBalanced(boolean enabled) { if (sToolkitSetFrameRateReadOnlyFlagValue) { mIsFrameRatePowerSavingsBalanced = enabled; } } /** * Get the value whether frameratepowersavingsbalance is enabled for this Window. * This allows device to adjust refresh rate * as needed and can be useful for power saving. * by {@link #setFrameRatePowerSavingsBalanced(boolean)} * * @return Whether we should enable frameratepowersavingsbalance. */ @FlaggedApi(android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY) public boolean isFrameRatePowerSavingsBalanced() { if (sToolkitSetFrameRateReadOnlyFlagValue) { return mIsFrameRatePowerSavingsBalanced; } return true; } /** * <p> * Blurs the screen behind the window. The effect is similar to that of {@link #dimAmount}, Loading Loading @@ -5055,6 +5086,7 @@ public interface WindowManager extends ViewManager { out.writeFloat(mDesiredHdrHeadroom); if (sToolkitSetFrameRateReadOnlyFlagValue) { out.writeBoolean(mFrameRateBoostOnTouch); out.writeBoolean(mIsFrameRatePowerSavingsBalanced); } } Loading Loading @@ -5130,6 +5162,7 @@ public interface WindowManager extends ViewManager { mDesiredHdrHeadroom = in.readFloat(); if (sToolkitSetFrameRateReadOnlyFlagValue) { mFrameRateBoostOnTouch = in.readBoolean(); mIsFrameRatePowerSavingsBalanced = in.readBoolean(); } } Loading Loading @@ -5473,6 +5506,12 @@ public interface WindowManager extends ViewManager { changes |= LAYOUT_CHANGED; } if (sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced != o.mIsFrameRatePowerSavingsBalanced) { mIsFrameRatePowerSavingsBalanced = o.mIsFrameRatePowerSavingsBalanced; changes |= LAYOUT_CHANGED; } return changes; } Loading Loading @@ -5700,6 +5739,11 @@ public interface WindowManager extends ViewManager { sb.append(prefix).append(" frameRateBoostOnTouch="); sb.append(mFrameRateBoostOnTouch); } if (sToolkitSetFrameRateReadOnlyFlagValue && mIsFrameRatePowerSavingsBalanced) { sb.append(System.lineSeparator()); sb.append(prefix).append(" dvrrWindowFrameRateHint="); sb.append(mIsFrameRatePowerSavingsBalanced); } if (paramsForRotation != null && paramsForRotation.length != 0) { sb.append(System.lineSeparator()); sb.append(prefix).append(" paramsForRotation:"); Loading
core/java/com/android/internal/policy/PhoneWindow.java +7 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private boolean mUseDecorContext = false; private boolean mIsFrameRatePowerSavingsBalanced = true; /** @see ViewRootImpl#mActivityConfigCallback */ private ActivityConfigCallback mActivityConfigCallback; Loading Loading @@ -2211,6 +2213,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { void onViewRootImplSet(ViewRootImpl viewRoot) { viewRoot.setActivityConfigCallback(mActivityConfigCallback); viewRoot.getOnBackInvokedDispatcher().updateContext(getContext()); viewRoot.setFrameRatePowerSavingsBalanced(mIsFrameRatePowerSavingsBalanced); mProxyOnBackInvokedDispatcher.setActualDispatcher(viewRoot.getOnBackInvokedDispatcher()); applyDecorFitsSystemWindows(); } Loading Loading @@ -2559,6 +2562,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (a.getBoolean(R.styleable.Window_windowActivityTransitions, false)) { requestFeature(FEATURE_ACTIVITY_TRANSITIONS); } if (a.hasValue(R.styleable.Window_windowIsFrameRatePowerSavingsBalanced)) { mIsFrameRatePowerSavingsBalanced = a.getBoolean(R.styleable.Window_windowIsFrameRatePowerSavingsBalanced, true); } mIsTranslucent = a.getBoolean(R.styleable.Window_windowIsTranslucent, false); Loading