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

Commit de3112e0 authored by Austin Borger's avatar Austin Borger
Browse files

AudioService: 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: Ia39312bef7b5b7bddcf76ae2feb3562b7cfbb921
parent c2e476c3
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.app.AppOpsManager;
import android.app.BroadcastOptions;
import android.app.IUidObserver;
import android.app.NotificationManager;
import android.app.UidObserver;
import android.app.role.OnRoleHoldersChangedListener;
import android.app.role.RoleManager;
import android.bluetooth.BluetoothAdapter;
@@ -959,29 +960,16 @@ public class AudioService extends IAudioService.Stub
        }
    }
    final private IUidObserver mUidObserver = new IUidObserver.Stub() {
        @Override public void onUidStateChanged(int uid, int procState, long procStateSeq,
            int capability) {
        }
    final private IUidObserver mUidObserver = new UidObserver() {
        @Override public void onUidGone(int uid, boolean disabled) {
            // Once the uid is no longer running, no need to keep trying to disable its audio.
            disableAudioForUid(false, uid);
        }
        @Override public void onUidActive(int uid) throws RemoteException {
        }
        @Override public void onUidIdle(int uid, boolean disabled) {
        }
        @Override public void onUidCachedChanged(int uid, boolean cached) {
            disableAudioForUid(cached, uid);
        }
        @Override public void onUidProcAdjChanged(int uid) {
        }
        private void disableAudioForUid(boolean disable, int uid) {
            queueMsgUnderWakeLock(mAudioHandler, MSG_DISABLE_AUDIO_FOR_UID,
                    disable ? 1 : 0 /* arg1 */,  uid /* arg2 */,