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

Commit 460cad0e authored by Justin Weir's avatar Justin Weir Committed by Automerger Merge Worker
Browse files

Merge "Move Volume control Binder calls to worker thread" into tm-dev am: 6f8b2f6d am: 7c9fa45a

parents 1c3f57c7 7c9fa45a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public interface VolumeDialogController {
    public interface Callbacks {
        int VERSION = 1;

        void onShowRequested(int reason);
        void onShowRequested(int reason, boolean keyguardLocked, int lockTaskModeState);
        void onDismissRequested(int reason);
        void onStateChanged(State state);
        void onLayoutDirectionChanged(int layoutDirection);
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna

    private void applyConfiguration() {
        mController.setVolumePolicy(mVolumePolicy);
        mController.showDndTile(true);
        mController.showDndTile();
    }

    @Override
+31 −36
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.volume;

import static android.media.AudioManager.RINGER_MODE_NORMAL;

import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -91,10 +93,8 @@ import javax.inject.Inject;
public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpable {
    private static final String TAG = Util.logTag(VolumeDialogControllerImpl.class);


    private static final int TOUCH_FEEDBACK_TIMEOUT_MS = 1000;
    private static final int DYNAMIC_STREAM_START_INDEX = 100;
    private static final int VIBRATE_HINT_DURATION = 50;
    private static final AudioAttributes SONIFICIATION_VIBRATION_ATTRIBUTES =
            new AudioAttributes.Builder()
                    .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
@@ -122,14 +122,16 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    private final PackageManager mPackageManager;
    private final MediaRouter2Manager mRouter2Manager;
    private final WakefulnessLifecycle mWakefulnessLifecycle;
    private AudioManager mAudio;
    private IAudioService mAudioService;
    private final AudioManager mAudio;
    private final IAudioService mAudioService;
    private final NotificationManager mNoMan;
    private final SettingObserver mObserver;
    private final Receiver mReceiver = new Receiver();
    private final RingerModeObservers mRingerModeObservers;
    private final MediaSessions mMediaSessions;
    private final CaptioningManager mCaptioningManager;
    private final KeyguardManager mKeyguardManager;
    private final ActivityManager mActivityManager;
    protected C mCallbacks = new C();
    private final State mState = new State();
    protected final MediaSessionsCallbacks mMediaSessionsCallbacksW;
@@ -141,9 +143,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    private long mLastToggledRingerOn;
    private boolean mDeviceInteractive = true;

    private boolean mDestroyed;
    private VolumePolicy mVolumePolicy;
    private boolean mShowDndTile = true;
    @GuardedBy("this")
    private UserActivityListener mUserActivityListener;

@@ -176,7 +176,10 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
            AccessibilityManager accessibilityManager,
            PackageManager packageManager,
            WakefulnessLifecycle wakefulnessLifecycle,
            CaptioningManager captioningManager) {
            CaptioningManager captioningManager,
            KeyguardManager keyguardManager,
            ActivityManager activityManager
    ) {
        mContext = context.getApplicationContext();
        mPackageManager = packageManager;
        mWakefulnessLifecycle = wakefulnessLifecycle;
@@ -202,6 +205,9 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        mHasVibrator = mVibrator.hasVibrator();
        mAudioService = iAudioService;
        mCaptioningManager = captioningManager;
        mKeyguardManager = keyguardManager;
        mActivityManager = activityManager;


        boolean accessibilityVolumeStreamActive = accessibilityManager
                .isAccessibilityVolumeStreamActive();
@@ -247,7 +253,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    public void register() {
        setVolumeController();
        setVolumePolicy(mVolumePolicy);
        showDndTile(mShowDndTile);
        showDndTile();
        try {
            mMediaSessions.init();
        } catch (SecurityException e) {
@@ -272,10 +278,8 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa

    public void dump(PrintWriter pw, String[] args) {
        pw.println(VolumeDialogControllerImpl.class.getSimpleName() + " state:");
        pw.print("  mDestroyed: "); pw.println(mDestroyed);
        pw.print("  mVolumePolicy: "); pw.println(mVolumePolicy);
        pw.print("  mState: "); pw.println(mState.toString(4));
        pw.print("  mShowDndTile: "); pw.println(mShowDndTile);
        pw.print("  mHasVibrator: "); pw.println(mHasVibrator);
        synchronized (mMediaSessionsCallbacksW.mRemoteStreams) {
            pw.print("  mRemoteStreams: ");
@@ -293,7 +297,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    }

    public void setUserActivityListener(UserActivityListener listener) {
        if (mDestroyed) return;
        synchronized (this) {
            mUserActivityListener = listener;
        }
@@ -304,7 +307,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    }

    public void getState() {
        if (mDestroyed) return;
        mWorker.sendEmptyMessage(W.GET_STATE);
    }

@@ -317,48 +319,39 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    }

    public void getCaptionsComponentState(boolean fromTooltip) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.GET_CAPTIONS_COMPONENT_STATE, fromTooltip).sendToTarget();
    }

    public void notifyVisible(boolean visible) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.NOTIFY_VISIBLE, visible ? 1 : 0, 0).sendToTarget();
    }

    public void userActivity() {
        if (mDestroyed) return;
        mWorker.removeMessages(W.USER_ACTIVITY);
        mWorker.sendEmptyMessage(W.USER_ACTIVITY);
    }

    public void setRingerMode(int value, boolean external) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_RINGER_MODE, value, external ? 1 : 0).sendToTarget();
    }

    public void setZenMode(int value) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_ZEN_MODE, value, 0).sendToTarget();
    }

    public void setExitCondition(Condition condition) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_EXIT_CONDITION, condition).sendToTarget();
    }

    public void setStreamMute(int stream, boolean mute) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_STREAM_MUTE, stream, mute ? 1 : 0).sendToTarget();
    }

    public void setStreamVolume(int stream, int level) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_STREAM_VOLUME, stream, level).sendToTarget();
    }

    public void setActiveStream(int stream) {
        if (mDestroyed) return;
        mWorker.obtainMessage(W.SET_ACTIVE_STREAM, stream, 0).sendToTarget();
    }

@@ -392,7 +385,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
    }

    private void onNotifyVisibleW(boolean visible) {
        if (mDestroyed) return;
        mAudio.notifyVolumeControllerVisible(mVolumeController, visible);
        if (!visible) {
            if (updateActiveStreamW(-1)) {
@@ -465,7 +457,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
            mCallbacks.onStateChanged(mState);
        }
        if (showUI) {
            mCallbacks.onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED);
            onShowRequestedW(Events.SHOW_REASON_VOLUME_CHANGED);
        }
        if (showVibrateHint) {
            mCallbacks.onShowVibrateHint();
@@ -645,6 +637,11 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        return true;
    }

    private void onShowRequestedW(int reason) {
        mCallbacks.onShowRequested(reason, mKeyguardManager.isKeyguardLocked(),
                mActivityManager.getLockTaskModeState());
    }

    private void onSetRingerModeW(int mode, boolean external) {
        if (external) {
            mAudio.setRingerMode(mode);
@@ -687,9 +684,9 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        mCallbacks.onDismissRequested(reason);
    }

    public void showDndTile(boolean visible) {
    public void showDndTile() {
        if (D.BUG) Log.d(TAG, "showDndTile");
        DndTile.setVisible(mContext, visible);
        DndTile.setVisible(mContext, true);
    }

    private final class VC extends IVolumeController.Stub {
@@ -699,7 +696,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        public void displaySafeVolumeWarning(int flags) throws RemoteException {
            if (D.BUG) Log.d(TAG, "displaySafeVolumeWarning "
                    + Util.audioManagerFlagsToString(flags));
            if (mDestroyed) return;
            mWorker.obtainMessage(W.SHOW_SAFETY_WARNING, flags, 0).sendToTarget();
        }

@@ -707,7 +703,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        public void volumeChanged(int streamType, int flags) throws RemoteException {
            if (D.BUG) Log.d(TAG, "volumeChanged " + AudioSystem.streamToString(streamType)
                    + " " + Util.audioManagerFlagsToString(flags));
            if (mDestroyed) return;
            mWorker.obtainMessage(W.VOLUME_CHANGED, streamType, flags).sendToTarget();
        }

@@ -719,14 +714,12 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        @Override
        public void setLayoutDirection(int layoutDirection) throws RemoteException {
            if (D.BUG) Log.d(TAG, "setLayoutDirection");
            if (mDestroyed) return;
            mWorker.obtainMessage(W.LAYOUT_DIRECTION_CHANGED, layoutDirection, 0).sendToTarget();
        }

        @Override
        public void dismiss() throws RemoteException {
            if (D.BUG) Log.d(TAG, "dismiss requested");
            if (mDestroyed) return;
            mWorker.obtainMessage(W.DISMISS_REQUESTED, Events.DISMISS_REASON_VOLUME_CONTROLLER, 0)
                    .sendToTarget();
            mWorker.sendEmptyMessage(W.DISMISS_REQUESTED);
@@ -735,7 +728,6 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        @Override
        public void setA11yMode(int mode) {
            if (D.BUG) Log.d(TAG, "setA11yMode to " + mode);
            if (mDestroyed) return;
            switch (mode) {
                case VolumePolicy.A11Y_MODE_MEDIA_A11Y_VOLUME:
                    // "legacy" mode
@@ -798,7 +790,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        }
    }

    class C implements Callbacks {
    static class C implements Callbacks {
        private final Map<Callbacks, Handler> mCallbackMap = new ConcurrentHashMap<>();

        public void add(Callbacks callback, Handler handler) {
@@ -811,12 +803,15 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        }

        @Override
        public void onShowRequested(final int reason) {
        public void onShowRequested(
                final int reason,
                final boolean keyguardLocked,
                final int lockTaskModeState) {
            for (final Map.Entry<Callbacks, Handler> entry : mCallbackMap.entrySet()) {
                entry.getValue().post(new Runnable() {
                    @Override
                    public void run() {
                        entry.getKey().onShowRequested(reason);
                        entry.getKey().onShowRequested(reason, keyguardLocked, lockTaskModeState);
                    }
                });
            }
@@ -923,7 +918,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa

        @Override
        public void onAccessibilityModeChanged(Boolean showA11yStream) {
            boolean show = showA11yStream == null ? false : showA11yStream;
            boolean show = showA11yStream != null && showA11yStream;
            for (final Map.Entry<Callbacks, Handler> entry : mCallbackMap.entrySet()) {
                entry.getValue().post(new Runnable() {
                    @Override
@@ -937,7 +932,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
        @Override
        public void onCaptionComponentStateChanged(
                Boolean isComponentEnabled, Boolean fromTooltip) {
            boolean componentEnabled = isComponentEnabled == null ? false : isComponentEnabled;
            boolean componentEnabled = isComponentEnabled != null && isComponentEnabled;
            for (final Map.Entry<Callbacks, Handler> entry : mCallbackMap.entrySet()) {
                entry.getValue().post(
                        () -> entry.getKey().onCaptionComponentStateChanged(
@@ -1183,7 +1178,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
                    mCallbacks.onStateChanged(mState);
                }
                if (showUI) {
                    mCallbacks.onShowRequested(Events.SHOW_REASON_REMOTE_VOLUME_CHANGED);
                    onShowRequestedW(Events.SHOW_REASON_REMOTE_VOLUME_CHANGED);
                }
            }
        }
+16 −30
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ public class VolumeDialogImpl implements VolumeDialog,
    private State mState;
    private SafetyWarningDialog mSafetyWarning;
    private boolean mHovering = false;
    private boolean mShowActiveStreamOnly;
    private final boolean mShowActiveStreamOnly;
    private boolean mConfigChanged = false;
    private boolean mIsAnimatingDismiss = false;
    private boolean mHasSeenODICaptionsTooltip;
@@ -327,7 +327,7 @@ public class VolumeDialogImpl implements VolumeDialog,
    }

    public void init(int windowType, Callback callback) {
        initDialog();
        initDialog(mActivityManager.getLockTaskModeState());

        mAccessibility.init();

@@ -394,7 +394,7 @@ public class VolumeDialogImpl implements VolumeDialog,
                Region.Op.UNION);
    }

    private void initDialog() {
    private void initDialog(int lockTaskModeState) {
        mDialog = new CustomDialog(mContext);

        initDimens();
@@ -589,7 +589,7 @@ public class VolumeDialogImpl implements VolumeDialog,

        updateRowsH(getActiveRow());
        initRingerH();
        initSettingsH();
        initSettingsH(lockTaskModeState);
        initODICaptionsH();
    }

@@ -1034,12 +1034,11 @@ public class VolumeDialogImpl implements VolumeDialog,
        mIsRingerDrawerOpen = false;
    }

    public void initSettingsH() {
    private void initSettingsH(int lockTaskModeState) {
        if (mSettingsView != null) {
            mSettingsView.setVisibility(
                    mDeviceProvisionedController.isCurrentUserSetup() &&
                            mActivityManager.getLockTaskModeState() == LOCK_TASK_MODE_NONE ?
                            VISIBLE : GONE);
                            lockTaskModeState == LOCK_TASK_MODE_NONE ? VISIBLE : GONE);
        }
        if (mSettingsIcon != null) {
            mSettingsIcon.setOnClickListener(v -> {
@@ -1292,7 +1291,7 @@ public class VolumeDialogImpl implements VolumeDialog,
        };
    }

    private void showH(int reason) {
    private void showH(int reason, boolean keyguardLocked, int lockTaskModeState) {
        Trace.beginSection("VolumeDialogImpl#showH");
        if (D.BUG) Log.d(TAG, "showH r=" + Events.SHOW_REASONS[reason]);
        mHandler.removeMessages(H.SHOW);
@@ -1300,16 +1299,16 @@ public class VolumeDialogImpl implements VolumeDialog,
        rescheduleTimeoutH();

        if (mConfigChanged) {
            initDialog(); // resets mShowing to false
            initDialog(lockTaskModeState); // resets mShowing to false
            mConfigurableTexts.update();
            mConfigChanged = false;
        }

        initSettingsH();
        initSettingsH(lockTaskModeState);
        mShowing = true;
        mIsAnimatingDismiss = false;
        mDialog.show();
        Events.writeEvent(Events.EVENT_SHOW_DIALOG, reason, mKeyguard.isKeyguardLocked());
        Events.writeEvent(Events.EVENT_SHOW_DIALOG, reason, keyguardLocked);
        mController.notifyVisible(true);
        mController.getCaptionsComponentState(false);
        checkODICaptionsTooltip(false);
@@ -1810,14 +1809,6 @@ public class VolumeDialogImpl implements VolumeDialog,
                mContext, com.android.internal.R.attr.textColorOnAccent);

        row.sliderProgressSolid.setTintList(colorTint);
        if (row.sliderBgIcon != null) {
            row.sliderBgIcon.setTintList(colorTint);
        }

        if (row.sliderBgSolid != null) {
            row.sliderBgSolid.setTintList(bgTint);
        }

        if (row.sliderProgressIcon != null) {
            row.sliderProgressIcon.setTintList(bgTint);
        }
@@ -2046,8 +2037,8 @@ public class VolumeDialogImpl implements VolumeDialog,
    private final VolumeDialogController.Callbacks mControllerCallbackH
            = new VolumeDialogController.Callbacks() {
        @Override
        public void onShowRequested(int reason) {
            showH(reason);
        public void onShowRequested(int reason, boolean keyguardLocked, int lockTaskModeState) {
            showH(reason, keyguardLocked, lockTaskModeState);
        }

        @Override
@@ -2130,7 +2121,8 @@ public class VolumeDialogImpl implements VolumeDialog,
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case SHOW: showH(msg.arg1); break;
                case SHOW: showH(msg.arg1, VolumeDialogImpl.this.mKeyguard.isKeyguardLocked(),
                        VolumeDialogImpl.this.mActivityManager.getLockTaskModeState()); break;
                case DISMISS: dismissH(msg.arg1); break;
                case RECHECK: recheckH((VolumeRow) msg.obj); break;
                case RECHECK_ALL: recheckH(null); break;
@@ -2152,7 +2144,7 @@ public class VolumeDialogImpl implements VolumeDialog,
         * within the bounds of the volume dialog, will fall through to the window below.
         */
        @Override
        public boolean dispatchTouchEvent(MotionEvent ev) {
        public boolean dispatchTouchEvent(@NonNull MotionEvent ev) {
            rescheduleTimeoutH();
            return super.dispatchTouchEvent(ev);
        }
@@ -2176,7 +2168,7 @@ public class VolumeDialogImpl implements VolumeDialog,
         * volume dialog.
         */
        @Override
        public boolean onTouchEvent(MotionEvent event) {
        public boolean onTouchEvent(@NonNull MotionEvent event) {
            if (mShowing) {
                if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    dismissH(Events.DISMISS_REASON_TOUCH_OUTSIDE);
@@ -2265,8 +2257,6 @@ public class VolumeDialogImpl implements VolumeDialog,
        private View view;
        private TextView header;
        private ImageButton icon;
        private Drawable sliderBgSolid;
        private AlphaTintDrawableWrapper sliderBgIcon;
        private Drawable sliderProgressSolid;
        private AlphaTintDrawableWrapper sliderProgressIcon;
        private SeekBar slider;
@@ -2280,7 +2270,6 @@ public class VolumeDialogImpl implements VolumeDialog,
        private int iconMuteRes;
        private boolean important;
        private boolean defaultStream;
        private ColorStateList cachedTint;
        private int iconState;  // from Events
        private ObjectAnimator anim;  // slider progress animation for non-touch-related updates
        private int animTargetProgress;
@@ -2295,9 +2284,6 @@ public class VolumeDialogImpl implements VolumeDialog,
            if (sliderProgressIcon != null) {
                sliderProgressIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
            }
            if (sliderBgIcon != null) {
                sliderBgIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
            }
        }
    }

+20 −5
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.volume;

import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -23,6 +25,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -91,6 +95,10 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
    private WakefulnessLifecycle mWakefullnessLifcycle;
    @Mock
    private CaptioningManager mCaptioningManager;
    @Mock
    private KeyguardManager mKeyguardManager;
    @Mock
    private ActivityManager mActivityManager;


    @Before
@@ -112,7 +120,8 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
        mVolumeController = new TestableVolumeDialogControllerImpl(mContext,
                mBroadcastDispatcher, mRingerModeTracker, mThreadFactory, mAudioManager,
                mNotificationManager, mVibrator, mIAudioService, mAccessibilityManager,
                mPackageManager, mWakefullnessLifcycle, mCaptioningManager, mCallback);
                mPackageManager, mWakefullnessLifcycle, mCaptioningManager, mKeyguardManager,
                mActivityManager, mCallback);
        mVolumeController.setEnableDialogs(true, true);
    }

@@ -129,7 +138,8 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
        when(mWakefullnessLifcycle.getWakefulness()).thenReturn(
                WakefulnessLifecycle.WAKEFULNESS_AWAKE);
        mVolumeController.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI);
        verify(mCallback, never()).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED);
        verify(mCallback, never()).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED, false,
                LOCK_TASK_MODE_NONE);
    }

    @Test
@@ -138,7 +148,8 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
        when(mWakefullnessLifcycle.getWakefulness()).thenReturn(
                WakefulnessLifecycle.WAKEFULNESS_AWAKE);
        mVolumeController.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI);
        verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED);
        verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED, false,
                LOCK_TASK_MODE_NONE);
    }

    @Test
@@ -151,7 +162,8 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
        when(mWakefullnessLifcycle.getWakefulness()).thenReturn(
                WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP);
        mVolumeController.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI);
        verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED);
        verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED, false,
                LOCK_TASK_MODE_NONE);
    }

    @Test
@@ -188,10 +200,13 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
                PackageManager packageManager,
                WakefulnessLifecycle wakefulnessLifecycle,
                CaptioningManager captioningManager,
                KeyguardManager keyguardManager,
                ActivityManager activityManager,
                C callback) {
            super(context, broadcastDispatcher, ringerModeTracker, theadFactory, audioManager,
                    notificationManager, optionalVibrator, iAudioService, accessibilityManager,
                    packageManager, wakefulnessLifecycle, captioningManager);
                    packageManager, wakefulnessLifecycle, captioningManager, keyguardManager,
                    activityManager);
            mCallbacks = callback;

            ArgumentCaptor<WakefulnessLifecycle.Observer> observerCaptor =