/* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.util.ArrayMap; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import java.util.Arrays; import java.util.Map; /** * GameModeInfo returned from {@link GameManager#getGameModeInfo(String)}. * * Developers can enable game modes or interventions by adding *
{@code ** to the* }
{@code, where the GAME_MODE_CONFIG_FILE is an XML file that * specifies the game mode enablement and intervention configuration: *}
{@code ** * @hide */ @SystemApi public final class GameModeInfo implements Parcelable { public static final @NonNull Creator* }
* Available games include all game modes that are either supported by the OEM in device * config, or overridden by the game developers in game mode config XML, plus the default * enabled modes for any game including {@link GameManager#GAME_MODE_STANDARD} and * {@link GameManager#GAME_MODE_CUSTOM}. *
* Also see {@link GameModeInfo}. */ @NonNull public @GameManager.GameMode int[] getAvailableGameModes() { return Arrays.copyOf(mAvailableGameModes, mAvailableGameModes.length); } /** * Gets the collection of {@link GameManager.GameMode} that are overridden by the game. *
* Also see {@link GameModeInfo}. */ @NonNull public @GameManager.GameMode int[] getOverriddenGameModes() { return Arrays.copyOf(mOverriddenGameModes, mOverriddenGameModes.length); } /** * Gets the current game mode configuration of a game mode. *
* The game mode can be null if it's overridden by the game itself, or not configured in device * config nor set by the user as custom game mode configuration. */ public @Nullable GameModeConfiguration getGameModeConfiguration( @GameManager.GameMode int gameMode) { return mConfigMap.get(gameMode); } /** * Returns if downscaling is allowed (not opted out) by the game in their Game Mode config. *
* Also see {@link GameModeInfo}. */ public boolean isDownscalingAllowed() { return mIsDownscalingAllowed; } /** * Returns if FPS override is allowed (not opted out) by the game in their Game Mode config. *
* Also see {@link GameModeInfo}.
*/
public boolean isFpsOverrideAllowed() {
return mIsFpsOverrideAllowed;
}
private final @GameManager.GameMode int[] mAvailableGameModes;
private final @GameManager.GameMode int[] mOverriddenGameModes;
private final @GameManager.GameMode int mActiveGameMode;
private final boolean mIsDownscalingAllowed;
private final boolean mIsFpsOverrideAllowed;
private final Map