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
This commit is contained in:
Austin Borger
2023-04-03 16:19:19 -07:00
parent 1131b8420b
commit 6f09a27ae6

View File

@@ -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);