FileDocCategorySizeDatePackage
VolumeUI.javaAPI DocAndroid 5.1 API7831Thu Mar 12 22:22:42 GMT 2015com.android.systemui.volume

VolumeUI

public class VolumeUI extends com.android.systemui.SystemUI

Fields Summary
private static final String
TAG
private static final String
SETTING
private static final android.net.Uri
SETTING_URI
private static final int
DEFAULT
private final android.os.Handler
mHandler
private boolean
mEnabled
private android.media.AudioManager
mAudioManager
private android.media.session.MediaSessionManager
mMediaSessionManager
private VolumeController
mVolumeController
private RemoteVolumeController
mRemoteVolumeController
private VolumePanel
mPanel
private int
mDismissDelay
private final android.database.ContentObserver
mObserver
private final Runnable
mStartZenSettings
Constructors Summary
Methods Summary
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        pw.print("mEnabled="); pw.println(mEnabled);
        if (mPanel != null) {
            mPanel.dump(fd, pw, args);
        }
    
private voidinitPanel()

        mDismissDelay = mContext.getResources().getInteger(R.integer.volume_panel_dismiss_delay);
        mPanel = new VolumePanel(mContext, new ZenModeControllerImpl(mContext, mHandler));
        mPanel.setCallback(new VolumePanel.Callback() {
            @Override
            public void onZenSettings() {
                mHandler.removeCallbacks(mStartZenSettings);
                mHandler.post(mStartZenSettings);
            }

            @Override
            public void onInteraction() {
                final KeyguardViewMediator kvm = getComponent(KeyguardViewMediator.class);
                if (kvm != null) {
                    kvm.userActivity();
                }
            }

            @Override
            public void onVisible(boolean visible) {
                if (mAudioManager != null && mVolumeController != null) {
                    mAudioManager.notifyVolumeControllerVisible(mVolumeController, visible);
                }
            }
        });
    
protected voidonConfigurationChanged(android.content.res.Configuration newConfig)

        super.onConfigurationChanged(newConfig);
        if (mPanel != null) {
            mPanel.onConfigurationChanged(newConfig);
        }
    
public voidstart()


    
       
        mEnabled = mContext.getResources().getBoolean(R.bool.enable_volume_ui);
        if (!mEnabled) return;
        mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
        mMediaSessionManager = (MediaSessionManager) mContext
                .getSystemService(Context.MEDIA_SESSION_SERVICE);
        initPanel();
        mVolumeController = new VolumeController();
        mRemoteVolumeController = new RemoteVolumeController();
        putComponent(VolumeComponent.class, mVolumeController);
        updateController();
        mContext.getContentResolver().registerContentObserver(SETTING_URI, false, mObserver);
    
private voidupdateController()

        if (Settings.Global.getInt(mContext.getContentResolver(), SETTING, DEFAULT) != 0) {
            Log.d(TAG, "Registering volume controller");
            mAudioManager.setVolumeController(mVolumeController);
            mMediaSessionManager.setRemoteVolumeController(mRemoteVolumeController);
        } else {
            Log.d(TAG, "Unregistering volume controller");
            mAudioManager.setVolumeController(null);
            mMediaSessionManager.setRemoteVolumeController(null);
        }