SystemBarspublic class SystemBars extends com.android.systemui.SystemUI implements ServiceMonitor.CallbacksEnsure 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 |
Methods Summary |
---|
private java.lang.RuntimeException | andLog(java.lang.String msg, java.lang.Throwable t)
Log.w(TAG, msg, t);
throw new RuntimeException(msg, t);
| private void | createStatusBarFromConfig()
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 void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
if (mStatusBar != null) {
mStatusBar.dump(fd, pw, args);
}
| protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
if (mStatusBar != null) {
mStatusBar.onConfigurationChanged(newConfig);
}
| public void | onNoService()
if (DEBUG) Log.d(TAG, "onNoService");
createStatusBarFromConfig(); // fallback to using an in-process implementation
| public long | onServiceStartAttempt()
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 void | start()
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
|
|