From 6f09a27ae68366600e69453c2971e15b09ae7072 Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Mon, 3 Apr 2023 16:19:19 -0700 Subject: [PATCH] PinnerService: 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. These callbacks do not need a "throws RemoteException" modifier, so that has been removed, as these can't be marked as override because the UidObserver class doesn't have them. Bug: 274486653 Test: Presubmit, smoke test on cuttlefish. Change-Id: I39d5da65a3e5eff6cea00709dacee3d4b3c6075d --- .../com/android/server/PinnerService.java | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java index c5eb25b9981ef..3fd6fe8afba61 100644 --- a/services/core/java/com/android/server/PinnerService.java +++ b/services/core/java/com/android/server/PinnerService.java @@ -26,8 +26,8 @@ import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.IActivityManager; -import android.app.IUidObserver; import android.app.SearchManager; +import android.app.UidObserver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -360,35 +360,18 @@ public final class PinnerService extends SystemService { private void registerUidListener() { try { - mAm.registerUidObserver(new IUidObserver.Stub() { + mAm.registerUidObserver(new UidObserver() { @Override - public void onUidGone(int uid, boolean disabled) throws RemoteException { + public void onUidGone(int uid, boolean disabled) { mPinnerHandler.sendMessage(PooledLambda.obtainMessage( PinnerService::handleUidGone, PinnerService.this, uid)); } @Override - public void onUidActive(int uid) throws RemoteException { + public void onUidActive(int uid) { mPinnerHandler.sendMessage(PooledLambda.obtainMessage( PinnerService::handleUidActive, PinnerService.this, uid)); } - - @Override - public void onUidIdle(int uid, boolean disabled) throws RemoteException { - } - - @Override - public void onUidStateChanged(int uid, int procState, long procStateSeq, - int capability) throws RemoteException { - } - - @Override - public void onUidCachedChanged(int uid, boolean cached) throws RemoteException { - } - - @Override - public void onUidProcAdjChanged(int uid) throws RemoteException { - } }, UID_OBSERVER_GONE | UID_OBSERVER_ACTIVE, 0, null); } catch (RemoteException e) { Slog.e(TAG, "Failed to register uid observer", e);