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

Commit 7998c248 authored by Xiang Wang's avatar Xiang Wang
Browse files

Introduce new game mode config xml resource file

If the new resource file parser fail to parse the boolean values from
the resource file due to tag not found in manifest or missing file, the
existing metadata values will be used to populate pre-existing flags

Bug: 214448560
Test: atest GameManagerTest
Change-Id: I1543a1bb84379a2e9322a65d41e44fa6014821b9
parent 052cb99b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -326,6 +326,8 @@ package android {
    field public static final int allowClearUserData = 16842757; // 0x1010005
    field public static final int allowClickWhenDisabled = 16844312; // 0x1010618
    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 allowNativeHeapPointerTagging = 16844306; // 0x1010612
    field public static final int allowParallelSyncs = 16843570; // 0x1010332
    field public static final int allowSingleTap = 16843353; // 0x1010259
@@ -1435,10 +1437,12 @@ package android {
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportedTypes;
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsBatteryGameMode;
    field public static final int supportsInlineSuggestions = 16844301; // 0x101060d
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
    field public static final int supportsMultipleDisplays = 16844182; // 0x1010596
    field public static final int supportsPerformanceGameMode;
    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsStylusHandwriting;
+1 −0
Original line number Diff line number Diff line
@@ -278,6 +278,7 @@ package android.app {
  }

  public final class GameManager {
    method @RequiresPermission(android.Manifest.permission.MANAGE_GAME_MODE) public boolean isAngleEnabled(@NonNull String);
    method public void setGameServiceProvider(@Nullable String);
  }

+6 −2
Original line number Diff line number Diff line
@@ -181,14 +181,18 @@ public final class GameManager {
    /**
     * Returns if ANGLE is enabled for a given package and user ID.
     * <p>
     * ANGLE (Almost Native Graphics Layer Engine) can translate OpenGL ES commands to Vulkan
     * commands. Enabling ANGLE may improve the performance and/or reduce the power consumption of
     * applications.
     * The caller must have {@link android.Manifest.permission#MANAGE_GAME_MODE}.
     *
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.MANAGE_GAME_MODE)
    public @GameMode boolean getAngleEnabled(@NonNull String packageName) {
    public @GameMode boolean isAngleEnabled(@NonNull String packageName) {
        try {
            return mService.getAngleEnabled(packageName, mContext.getUserId());
            return mService.isAngleEnabled(packageName, mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ interface IGameManagerService {
    int getGameMode(String packageName, int userId);
    void setGameMode(String packageName, int gameMode, int userId);
    int[] getAvailableGameModes(String packageName);
    boolean getAngleEnabled(String packageName, int userId);
    boolean isAngleEnabled(String packageName, int userId);
    void setGameState(String packageName, in GameState gameState, int userId);
    GameModeInfo getGameModeInfo(String packageName, int userId);
    void setGameServiceProvider(String packageName);
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ public class GraphicsEnvironment {
    private boolean isAngleEnabledByGameMode(Context context, String packageName) {
        try {
            final boolean gameModeEnabledAngle =
                    (mGameManager != null) && mGameManager.getAngleEnabled(packageName);
                    (mGameManager != null) && mGameManager.isAngleEnabled(packageName);
            Log.v(TAG, "ANGLE GameManagerService for " + packageName + ": " + gameModeEnabledAngle);
            return gameModeEnabledAngle;
        } catch (SecurityException e) {
Loading