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

Commit 8f43fdf1 authored by Xiang Wang's avatar Xiang Wang
Browse files

Add allowGameFpsOverride intervention flag

Similar to Angle intervention, to turn off FPS overriding, the app
needs to have this flag disabled.

Bug: 214448560
Test: atest GameManagerServicesTest
Change-Id: I228beb39e9ba2649ee09fe165c0ff0c3bc7f1887
parent 7998c248
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -328,6 +328,7 @@ package android {
    field public static final int allowEmbedded = 16843765; // 0x10103f5
    field public static final int allowGameAngleDriver;
    field public static final int allowGameDownscaling;
    field public static final int allowGameFpsOverride;
    field public static final int allowNativeHeapPointerTagging = 16844306; // 0x1010612
    field public static final int allowParallelSyncs = 16843570; // 0x1010332
    field public static final int allowSingleTap = 16843353; // 0x1010259
+2 −0
Original line number Diff line number Diff line
@@ -8887,6 +8887,8 @@
        <attr name="allowGameAngleDriver" format="boolean" />
        <!-- Set true to allow resolution downscaling intervention. -->
        <attr name="allowGameDownscaling" format="boolean" />
        <!-- Set true to allow FPS override intervention. -->
        <attr name="allowGameFpsOverride" format="boolean" />
    </declare-styleable>
    <!-- Use <code>voice-enrollment-application</code>
+1 −0
Original line number Diff line number Diff line
@@ -3259,6 +3259,7 @@
    <public name="supportsPerformanceGameMode" />
    <public name="allowGameAngleDriver" />
    <public name="allowGameDownscaling" />
    <public name="allowGameFpsOverride" />
    <public name="localeConfig" />
    <public name="showBackground" />
    <public name="inheritKeyStoreKeys" />
+7 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;

import static com.android.internal.R.styleable.GameModeConfig_allowGameAngleDriver;
import static com.android.internal.R.styleable.GameModeConfig_allowGameDownscaling;
import static com.android.internal.R.styleable.GameModeConfig_allowGameFpsOverride;
import static com.android.internal.R.styleable.GameModeConfig_supportsBatteryGameMode;
import static com.android.internal.R.styleable.GameModeConfig_supportsPerformanceGameMode;
import static com.android.server.wm.CompatModePackages.DOWNSCALED;
@@ -452,6 +453,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
        private boolean mBatteryModeOptedIn;
        private boolean mAllowDownscale;
        private boolean mAllowAngle;
        private boolean mAllowFpsOverride;

        GamePackageConfiguration(String packageName, int userId) {
            mPackageName = packageName;
@@ -470,6 +472,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
                        mBatteryModeOptedIn = false;
                        mAllowDownscale = true;
                        mAllowAngle = true;
                        mAllowFpsOverride = true;
                    }
                }
            } catch (NameNotFoundException e) {
@@ -527,6 +530,8 @@ public final class GameManagerService extends IGameManagerService.Stub {
                        mAllowDownscale = array.getBoolean(GameModeConfig_allowGameDownscaling,
                                true);
                        mAllowAngle = array.getBoolean(GameModeConfig_allowGameAngleDriver, true);
                        mAllowFpsOverride = array.getBoolean(GameModeConfig_allowGameFpsOverride,
                                true);
                        array.recycle();
                    }
                }
@@ -565,7 +570,8 @@ public final class GameManagerService extends IGameManagerService.Stub {
                mScaling = !mAllowDownscale || willGamePerformOptimizations(mGameMode)
                        ? DEFAULT_SCALING : parser.getString(SCALING_KEY, DEFAULT_SCALING);

                mFps = parser.getString(FPS_KEY, DEFAULT_FPS);
                mFps = mAllowFpsOverride && !willGamePerformOptimizations(mGameMode)
                        ? parser.getString(FPS_KEY, DEFAULT_FPS) : DEFAULT_FPS;
                // We only want to use ANGLE if:
                // - We're allowed to use ANGLE (the app hasn't opted out via the manifest) AND
                // - The app has not opted in to performing the work itself AND
+9 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<game-mode-config
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:supportsPerformanceGameMode="false"
    android:supportsBatteryGameMode="false"
    android:allowGameAngleDriver="false"
    android:allowGameDownscaling="false"
    android:allowGameFpsOverride="false"
/>
 No newline at end of file
Loading