FileDocCategorySizeDatePackage
SystemBars.javaAPI DocAndroid 5.1 API4013Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar

SystemBars

public class SystemBars extends com.android.systemui.SystemUI implements ServiceMonitor.Callbacks
Ensure a single status bar service implementation is running at all times.

The implementation either comes from a service component running in a remote process (defined using a secure setting), else falls back to using the in-process implementation according to the product config.

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
private static final int
WAIT_FOR_BARS_TO_DIE
private ServiceMonitor
mServiceMonitor
private BaseStatusBar
mStatusBar
Constructors Summary
Methods Summary
private java.lang.RuntimeExceptionandLog(java.lang.String msg, java.lang.Throwable t)

        Log.w(TAG, msg, t);
        throw new RuntimeException(msg, t);
    
private voidcreateStatusBarFromConfig()

        if (DEBUG) Log.d(TAG, "createStatusBarFromConfig");
        final String clsName = mContext.getString(R.string.config_statusBarComponent);
        if (clsName == null || clsName.length() == 0) {
            throw andLog("No status bar component configured", null);
        }
        Class<?> cls = null;
        try {
            cls = mContext.getClassLoader().loadClass(clsName);
        } catch (Throwable t) {
            throw andLog("Error loading status bar component: " + clsName, t);
        }
        try {
            mStatusBar = (BaseStatusBar) cls.newInstance();
        } catch (Throwable t) {
            throw andLog("Error creating status bar component: " + clsName, t);
        }
        mStatusBar.mContext = mContext;
        mStatusBar.mComponents = mComponents;
        mStatusBar.start();
        if (DEBUG) Log.d(TAG, "started " + mStatusBar.getClass().getSimpleName());
    
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        if (mStatusBar != null) {
            mStatusBar.dump(fd, pw, args);
        }
    
protected voidonConfigurationChanged(android.content.res.Configuration newConfig)

        if (mStatusBar != null) {
            mStatusBar.onConfigurationChanged(newConfig);
        }
    
public voidonNoService()

        if (DEBUG) Log.d(TAG, "onNoService");
        createStatusBarFromConfig();  // fallback to using an in-process implementation
    
public longonServiceStartAttempt()

        if (DEBUG) Log.d(TAG, "onServiceStartAttempt mStatusBar="+mStatusBar);
        if (mStatusBar != null) {
            // tear down the in-process version, we'll recreate it again if needed
            mStatusBar.destroy();
            mStatusBar = null;
            return WAIT_FOR_BARS_TO_DIE;
        }
        return 0;
    
public voidstart()


    
       
        if (DEBUG) Log.d(TAG, "start");
        mServiceMonitor = new ServiceMonitor(TAG, DEBUG,
                mContext, Settings.Secure.BAR_SERVICE_COMPONENT, this);
        mServiceMonitor.start();  // will call onNoService if no remote service is found