Android 2.3 StatusBar 分析(一)

1,Framework/base/services/java/com/android/server/SystemServer.java
http://www.google.com/codesearch#uX1GffpyOZk/services/java/com/android/server/SystemServer.java&q=SystemServer&type=cs
StatusBarManagerService statusBar = null;
try {
                Slog.i(TAG, "Status Bar");
                statusBar = new StatusBarManagerService(context);
                ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);
            } catch (Throwable e) {
                Slog.e(TAG, "Failure starting StatusBarManagerService", e);
            }
...
if (statusBar != null) {
            statusBar.systemReady();
        }
final StatusBarManagerService statusBarF = statusBar;

if (statusBarF != null) statusBarF.systemReady2();


SystemServer会初始化StatusBarMangerService,并会当system ready的时候呼叫StatusBarManagerService的SystemReady2

2,framework/base/services/java/com/android/server/StatusBarMangerService.java
http://www.google.com/codesearch#x7kYzfrzW5Q/services/java/com/android/server/StatusBarManagerService.java&ct=rc&cd=9&q=IStatusBarService
StatusBarManagerService extends IStatusBarService.Stub
public void systemReady2() {
        ComponentName cn = ComponentName.unflattenFromString(
                mContext.getString(com.android.internal.R.string.config_statusBarComponent));
        Intent intent = new Intent();
        intent.setComponent(cn);
        Slog.i(TAG, "Starting service: " + cn);
        mContext.startService(intent);
    }


systemReady会启动SystemUI中的StatusBarService
<string name="config_statusBarComponent">com.android.systemui/com.android.systemui.statusbar.StatusBarService</string>




3,framework/base/core/java/com/android/internal/statusbar
1)IStatusBar.aidl
2)IStatusBarService.aidl
3)StatusBarIcon.aidl
4)StatusBarIconList.aidl
5)StatusBarNotification.aidl
6)StatusBarNotificationList.aidl
7)StatusBarIcon.java
8)StatusBarIconList.java
9)StatusBarNotification.java
这些主要是一些aidl file. ADIL,就是不同进程之间的桥梁。这里的IStatusBarsService.aidl就是StatusBarManagerService与StatusBarManger的桥梁。StatusBarManagerService<----IStatusBarsService--->StatusBarManger.

我们会在SystemUI中的StatusBarService和StatusbarPolicy中会看到这样的代码:
IStatusBarService mBarService;
mBarService = IStatusBarService.Stub.asInterface(
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));


4,framework/base/core/java/android/app/StatusBarManger.java
http://www.google.com/codesearch#uX1GffpyOZk/core/java/android/app/StatusBarManager.java&ct=rc&cd=1&q=StatusBarManager

5,framework/base/packages/SystemUI

你可能感兴趣的:(android)