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

Commit 654444a7 authored by Austin Borger's avatar Austin Borger
Browse files

GameManagerService: Use the default UidObserver implementation.

A class which overrides IUidObserver.Stub with empty callback
implementations was added in change
I2ff1e868586861e4dcd6586ad22139ba84eaf39c to simplify BroadcastQueue
interface complexity. Using this default implementation will mean less
churn when new callbacks are added to IUidObserver, or existing callback
method signatures are changed.

Bug: 274486653
Test: Presubmit, smoke test on cuttlefish.
Change-Id: Ief2d65e23e0967f6d4d9812af41f433dede9af3d
parent eebca7af
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2371,10 +2371,10 @@ HSPLcom/android/server/am/UserController;->unsafeConvertIncomingUser(I)I
HSPLcom/android/server/am/UserController;->updateStartedUserArrayLU()V
HSPLcom/android/server/am/UserState;-><init>(Landroid/os/UserHandle;)V
HSPLcom/android/server/app/GameManagerService$LocalService;->getResolutionScalingFactor(Ljava/lang/String;I)F
HSPLcom/android/server/app/GameManagerService$UidObserver$$ExternalSyntheticLambda0;-><init>(Lcom/android/server/app/GameManagerService$UidObserver;I)V
HSPLcom/android/server/app/GameManagerService$UidObserver$$ExternalSyntheticLambda0;->test(Ljava/lang/Object;)Z
HSPLcom/android/server/app/GameManagerService$UidObserver;->disableGameMode(I)V+]Ljava/util/Set;Ljava/util/HashSet;]Landroid/os/PowerManagerInternal;Lcom/android/server/power/PowerManagerService$LocalService;
HSPLcom/android/server/app/GameManagerService$UidObserver;->onUidStateChanged(IIJI)V+]Lcom/android/server/app/GameManagerService$UidObserver;Lcom/android/server/app/GameManagerService$UidObserver;]Ljava/util/stream/Stream;Ljava/util/stream/ReferencePipeline$Head;]Landroid/content/Context;Landroid/app/ContextImpl;]Landroid/content/pm/PackageManager;Landroid/app/ApplicationPackageManager;]Landroid/os/PowerManagerInternal;Lcom/android/server/power/PowerManagerService$LocalService;]Ljava/util/Set;Ljava/util/HashSet;
HSPLcom/android/server/app/GameManagerService$MyUidObserver$$ExternalSyntheticLambda0;-><init>(Lcom/android/server/app/GameManagerService$MyUidObserver;I)V
HSPLcom/android/server/app/GameManagerService$MyUidObserver$$ExternalSyntheticLambda0;->test(Ljava/lang/Object;)Z
HSPLcom/android/server/app/GameManagerService$MyUidObserver;->disableGameMode(I)V+]Ljava/util/Set;Ljava/util/HashSet;]Landroid/os/PowerManagerInternal;Lcom/android/server/power/PowerManagerService$LocalService;
HSPLcom/android/server/app/GameManagerService$MyUidObserver;->onUidStateChanged(IIJI)V+]Lcom/android/server/app/GameManagerService$MyUidObserver;Lcom/android/server/app/GameManagerService$MyUidObserver;]Ljava/util/stream/Stream;Ljava/util/stream/ReferencePipeline$Head;]Landroid/content/Context;Landroid/app/ContextImpl;]Landroid/content/pm/PackageManager;Landroid/app/ApplicationPackageManager;]Landroid/os/PowerManagerInternal;Lcom/android/server/power/PowerManagerService$LocalService;]Ljava/util/Set;Ljava/util/HashSet;
HSPLcom/android/server/app/GameManagerService;->-$$Nest$fgetmContext(Lcom/android/server/app/GameManagerService;)Landroid/content/Context;
HSPLcom/android/server/app/GameManagerService;->-$$Nest$fgetmForegroundGameUids(Lcom/android/server/app/GameManagerService;)Ljava/util/Set;
HSPLcom/android/server/app/GameManagerService;->-$$Nest$fgetmUidObserverLock(Lcom/android/server/app/GameManagerService;)Ljava/lang/Object;
+4 −16
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@ import android.app.GameModeInfo;
import android.app.GameState;
import android.app.IGameManagerService;
import android.app.IGameModeListener;
import android.app.IUidObserver;
import android.app.StatsManager;
import android.app.UidObserver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -169,7 +169,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
    private final Object mUidObserverLock = new Object();
    @VisibleForTesting
    @Nullable
    final UidObserver mUidObserver;
    final MyUidObserver mUidObserver;
    @GuardedBy("mUidObserverLock")
    private final Set<Integer> mForegroundGameUids = new HashSet<>();

@@ -209,7 +209,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
        } else {
            mGameServiceController = null;
        }
        mUidObserver = new UidObserver();
        mUidObserver = new MyUidObserver();
        try {
            ActivityManager.getService().registerUidObserver(mUidObserver,
                    ActivityManager.UID_OBSERVER_PROCSTATE | ActivityManager.UID_OBSERVER_GONE,
@@ -2143,10 +2143,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
     */
    private static native void nativeSetOverrideFrameRate(int uid, float frameRate);

    final class UidObserver extends IUidObserver.Stub {
        @Override
        public void onUidIdle(int uid, boolean disabled) {}

    final class MyUidObserver extends UidObserver {
        @Override
        public void onUidGone(int uid, boolean disabled) {
            synchronized (mUidObserverLock) {
@@ -2154,9 +2151,6 @@ public final class GameManagerService extends IGameManagerService.Stub {
            }
        }

        @Override
        public void onUidActive(int uid) {}

        @Override
        public void onUidStateChanged(int uid, int procState, long procStateSeq, int capability) {
            synchronized (mUidObserverLock) {
@@ -2197,11 +2191,5 @@ public final class GameManagerService extends IGameManagerService.Stub {
                mPowerManagerInternal.setPowerMode(Mode.GAME, false);
            }
        }

        @Override
        public void onUidCachedChanged(int uid, boolean cached) {}

        @Override
        public void onUidProcAdjChanged(int uid) {}
    }
}