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

Commit 31bfe866 authored by Jian-Syuan (Shane) Wong's avatar Jian-Syuan (Shane) Wong Committed by Android (Google) Code Review
Browse files

Merge "Make toolkit_frame_rate_function_enabling_read_only only avoid calls to...

Merge "Make toolkit_frame_rate_function_enabling_read_only only avoid calls to SurfaceFling" into main
parents 0c14f67e a5c81755
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ import static android.view.flags.Flags.toolkitFrameRateVelocityMappingReadOnly;
import static android.view.flags.Flags.toolkitMetricsForFrameRateDecision;
import static android.view.flags.Flags.toolkitSetFrameRateReadOnly;
import static android.view.flags.Flags.toolkitFrameRateFunctionEnablingReadOnly;
import static android.view.flags.Flags.toolkitFrameRateViewEnablingReadOnly;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER;
@@ -1153,6 +1154,7 @@ public final class ViewRootImpl implements ViewParent,
    private static boolean sToolkitFrameRateFunctionEnablingReadOnlyFlagValue;
    private static boolean sToolkitMetricsForFrameRateDecisionFlagValue;
    private static boolean sToolkitFrameRateTypingReadOnlyFlagValue;
    private static final boolean sToolkitFrameRateViewEnablingReadOnlyFlagValue;
    private static boolean sToolkitFrameRateVelocityMappingReadOnlyFlagValue =
            toolkitFrameRateVelocityMappingReadOnly();;
@@ -1162,6 +1164,8 @@ public final class ViewRootImpl implements ViewParent,
        sToolkitFrameRateTypingReadOnlyFlagValue = toolkitFrameRateTypingReadOnly();
        sToolkitFrameRateFunctionEnablingReadOnlyFlagValue =
                toolkitFrameRateFunctionEnablingReadOnly();
        sToolkitFrameRateViewEnablingReadOnlyFlagValue =
                toolkitFrameRateViewEnablingReadOnly();
    }
    // The latest input event from the gesture that was used to resolve the pointer icon.
@@ -2624,8 +2628,10 @@ public final class ViewRootImpl implements ViewParent,
        // no longer needed if the dVRR feature is disabled.
        if (shouldEnableDvrr()) {
            try {
                if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
                    mFrameRateTransaction.setFrameRateSelectionStrategy(sc,
                        sc.FRAME_RATE_SELECTION_STRATEGY_SELF).applyAsyncUnsafe();
                }
            } catch (Exception e) {
                Log.e(mTag, "Unable to set frame rate selection strategy ", e);
            }
@@ -12536,10 +12542,12 @@ public final class ViewRootImpl implements ViewParent,
                                    + category + ", reason " + reason + ", "
                                    + sourceView);
                }
                if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
                    mFrameRateTransaction.setFrameRateCategory(mSurfaceControl,
                        frameRateCategory, false).applyAsyncUnsafe();
                    mLastPreferredFrameRateCategory = frameRateCategory;
                }
            }
        } catch (Exception e) {
            Log.e(mTag, "Unable to set frame rate category", e);
        } finally {
@@ -12595,10 +12603,12 @@ public final class ViewRootImpl implements ViewParent,
                                + preferredFrameRate + " compatibility "
                                + mFrameRateCompatibility);
                }
                if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
                    mFrameRateTransaction.setFrameRate(mSurfaceControl, preferredFrameRate,
                    mFrameRateCompatibility).applyAsyncUnsafe();
                    mLastPreferredFrameRate = preferredFrameRate;
                }
            }
        } catch (Exception e) {
            Log.e(mTag, "Unable to set frame rate", e);
        } finally {
@@ -12824,7 +12834,7 @@ public final class ViewRootImpl implements ViewParent,
    private boolean shouldEnableDvrr() {
        // uncomment this when we are ready for enabling dVRR
        if (sToolkitFrameRateFunctionEnablingReadOnlyFlagValue) {
        if (sToolkitFrameRateViewEnablingReadOnlyFlagValue) {
            return sToolkitSetFrameRateReadOnlyFlagValue && isFrameRatePowerSavingsBalanced();
        }
        return false;