Loading services/core/java/com/android/server/app/GameManagerService.java +20 −8 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ package com.android.server.app; import static android.content.Intent.ACTION_PACKAGE_ADDED; import static android.content.Intent.ACTION_PACKAGE_CHANGED; import static android.content.Intent.ACTION_PACKAGE_REMOVED; import static android.content.Intent.EXTRA_REPLACING; import static com.android.internal.R.styleable.GameModeConfig_allowGameAngleDriver; import static com.android.internal.R.styleable.GameModeConfig_allowGameDownscaling; Loading Loading @@ -1467,7 +1467,6 @@ public final class GameManagerService extends IGameManagerService.Stub { private void registerPackageReceiver() { final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(ACTION_PACKAGE_ADDED); packageFilter.addAction(ACTION_PACKAGE_CHANGED); packageFilter.addAction(ACTION_PACKAGE_REMOVED); packageFilter.addDataScheme("package"); final BroadcastReceiver packageReceiver = new BroadcastReceiver() { Loading @@ -1492,17 +1491,30 @@ public final class GameManagerService extends IGameManagerService.Stub { } switch (intent.getAction()) { case ACTION_PACKAGE_ADDED: case ACTION_PACKAGE_CHANGED: updateConfigsForUser(userId, packageName); break; case ACTION_PACKAGE_REMOVED: disableCompatScale(packageName); // If EXTRA_REPLACING is true, it means there will be an // ACTION_PACKAGE_ADDED triggered after this because this // is an updated package that gets installed. Hence, disable // resolution downscaling effort but avoid removing the server // or commandline overriding configurations because those will // not change but the package game mode configurations may change // which may opt in and/or opt out some game mode configurations. if (!intent.getBooleanExtra(EXTRA_REPLACING, false)) { synchronized (mOverrideConfigLock) { mOverrideConfigs.remove(packageName); } synchronized (mDeviceConfigLock) { mConfigs.remove(packageName); } synchronized (mLock) { if (mSettings.containsKey(userId)) { mSettings.get(userId).removeGame(packageName); } } } break; default: // do nothing Loading services/core/java/com/android/server/app/GameManagerSettings.java +8 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,14 @@ public class GameManagerSettings { mGameModes.put(packageName, gameMode); } /** * Remove the game mode of a given package. * This operation must be synced with an external lock. */ void removeGame(String packageName) { mGameModes.remove(packageName); } /** * Write all current game service settings into disk. * This operation must be synced with an external lock. Loading Loading
services/core/java/com/android/server/app/GameManagerService.java +20 −8 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ package com.android.server.app; import static android.content.Intent.ACTION_PACKAGE_ADDED; import static android.content.Intent.ACTION_PACKAGE_CHANGED; import static android.content.Intent.ACTION_PACKAGE_REMOVED; import static android.content.Intent.EXTRA_REPLACING; import static com.android.internal.R.styleable.GameModeConfig_allowGameAngleDriver; import static com.android.internal.R.styleable.GameModeConfig_allowGameDownscaling; Loading Loading @@ -1467,7 +1467,6 @@ public final class GameManagerService extends IGameManagerService.Stub { private void registerPackageReceiver() { final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(ACTION_PACKAGE_ADDED); packageFilter.addAction(ACTION_PACKAGE_CHANGED); packageFilter.addAction(ACTION_PACKAGE_REMOVED); packageFilter.addDataScheme("package"); final BroadcastReceiver packageReceiver = new BroadcastReceiver() { Loading @@ -1492,17 +1491,30 @@ public final class GameManagerService extends IGameManagerService.Stub { } switch (intent.getAction()) { case ACTION_PACKAGE_ADDED: case ACTION_PACKAGE_CHANGED: updateConfigsForUser(userId, packageName); break; case ACTION_PACKAGE_REMOVED: disableCompatScale(packageName); // If EXTRA_REPLACING is true, it means there will be an // ACTION_PACKAGE_ADDED triggered after this because this // is an updated package that gets installed. Hence, disable // resolution downscaling effort but avoid removing the server // or commandline overriding configurations because those will // not change but the package game mode configurations may change // which may opt in and/or opt out some game mode configurations. if (!intent.getBooleanExtra(EXTRA_REPLACING, false)) { synchronized (mOverrideConfigLock) { mOverrideConfigs.remove(packageName); } synchronized (mDeviceConfigLock) { mConfigs.remove(packageName); } synchronized (mLock) { if (mSettings.containsKey(userId)) { mSettings.get(userId).removeGame(packageName); } } } break; default: // do nothing Loading
services/core/java/com/android/server/app/GameManagerSettings.java +8 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,14 @@ public class GameManagerSettings { mGameModes.put(packageName, gameMode); } /** * Remove the game mode of a given package. * This operation must be synced with an external lock. */ void removeGame(String packageName) { mGameModes.remove(packageName); } /** * Write all current game service settings into disk. * This operation must be synced with an external lock. Loading