Android Audio Service Volume Controller, 볼륨 UI 업데이트

6604 단어
 
  
 SystemUI           AudioService    VolumeDialogControllerImpl     IVolumeController.Stub VC。
            VolumeController   UI   。
 
  
06-21 12:55:21.770  3122  3122 W System.err: java.lang.Exception: setVolumeController
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.volume.VolumeDialogControllerImpl.setVolumeController(VolumeDialogControllerImpl.java:150)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.volume.VolumeDialogControllerImpl.register(VolumeDialogControllerImpl.java:176)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.volume.VolumeDialogComponent.register(VolumeDialogComponent.java:171)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.volume.VolumeUI.setDefaultVolumeController(VolumeUI.java:71)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.volume.VolumeUI.start(VolumeUI.java:47)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:215)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:164)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.systemui.SystemUIService.onCreate(SystemUIService.java:33)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:3339)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.app.ActivityThread.-wrap4(Unknown Source:0)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.os.Looper.loop(Looper.java:164)
06-21 12:55:21.771  3122  3122 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6494)
06-21 12:55:21.771  3122  3122 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
06-21 12:55:21.771  3122  3122 W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
06-21 12:55:21.772  3122  3122 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
06-21 12:55:21.774  2979  3337 D AudioService: Volume controller: VolumeController(android.os.BinderProxy@337c8cc,mVisible=false)
    @Override
    public void setVolumeController(final IVolumeController controller) {
        enforceVolumeController("set the volume controller");

        // return early if things are not actually changing
        if (mVolumeController.isSameBinder(controller)) {
            return;
        }

        // dismiss the old volume controller
        mVolumeController.postDismiss();
        if (controller != null) {
            // we are about to register a new controller, listen for its death
            try {
                controller.asBinder().linkToDeath(new DeathRecipient() {
                    @Override
                    public void binderDied() {
                        if (mVolumeController.isSameBinder(controller)) {
                            Log.w(TAG, "Current remote volume controller died, unregistering");
                            setVolumeController(null);
                        }
                    }
                }, 0);
            } catch (RemoteException e) {
                // noop
            }
        }
        mVolumeController.setController(controller);
        if (DEBUG_VOL) Log.d(TAG, "Volume controller: " + mVolumeController);
    private final class VC extends IVolumeController.Stub {
        private final String TAG = VolumeDialogControllerImpl.TAG + ".VC";

        @Override
        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();
        }

        @Override
        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();
        }

        @Override
        public void masterMuteChanged(int flags) throws RemoteException {
            if (D.BUG) Log.d(TAG, "masterMuteChanged");
        }

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

        @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
                    mShowA11yStream = false;
                    break;
                case VolumePolicy.A11Y_MODE_INDEPENDENT_A11Y_VOLUME:
                    mShowA11yStream = true;
                    break;
                default:
                    Log.e(TAG, "Invalid accessibility mode " + mode);
                    break;
            }
            mWorker.obtainMessage(W.ACCESSIBILITY_MODE_CHANGED, mShowA11yStream).sendToTarget();
        }
    }


좋은 웹페이지 즐겨찾기