android4.0 statusbar的启动
来源:互联网 发布:典型网络暴力事例 编辑:程序博客网 时间:2024/05/22 06:06
SystemServer.java
public static final void init2() {
//启动ServerThread
Thread thr = new ServerThread();
thr.setName("android.server.ServerThread");
thr.start();
}
ServerThread中
public void run() {
//启动SystemUi service
startSystemUi(contextF);
……
}
static final void startSystemUi(Context context) {
Intent intent = new Intent();
//component第一个参数是包名,第二个参数类名
intent.setComponent(new ComponentName("com.android.systemui",
"com.android.systemui.SystemUIService"));
//启动SystemUI的service
context.startService(intent);
}
SystemUIService.java
public class SystemUIService extends Service {
//在此,final代表SERVICES这个指针的指向不可变,但是指针指向的空间保存值可变
final Object[] SERVICES = new Object[] {
//要启动的Servic,将在下面加进去
0,
com.android.systemui.power.PowerUI.class,
};
//这个函数比较牛逼,主要是根据o来决定load 哪个class,不是对象!
private Class chooseClass(Object o) {
if (o instanceof Integer) {
final String cl = getString((Integer)o);
try {
return getClassLoader().loadClass(cl);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
} else if (o instanceof Class) {
return (Class)o;
} else {
throw new RuntimeException("Unknown system ui service: " + o);
}
}
public void onCreate() {
IWindowManager wm = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
try {
//根据statusbar是否隐藏决定要启动的service name
SERVICES[0] = wm.canStatusBarHide()
? R.string.config_statusBarComponent
: R.string.config_systemBarComponent;
} catch (RemoteException e) {
}
final int N = SERVICES.length;
mServices = new SystemUI[N];
for (int i=0; i<N; i++) {
Class cl = chooseClass(SERVICES[i]);
try {
//初始化实例对象
mServices[i] = (SystemUI)cl.newInstance();
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
} catch (InstantiationException ex) {
throw new RuntimeException(ex);
}
mServices[i].mContext = this;
//从start启动
mServices[i].start();
}
}
}
之后开始了启动PhoneStatusBar.class和com.android.systemui.power.PowerUI.class
StatusBar和PowerUI就是这样启动的
- android4.0 statusbar的启动
- Android4.0 StatusBar状态栏启动
- Android4.0 StatusBar状态栏启动
- Android4.0 中 隐藏底部的statusBar
- Android4.0的StatusBar和NavigationBar
- Android4.0的StatusBar和NavigationBar
- Android4.0 中 隐藏底部的statusBar
- android4.0 statusbar加载icon
- android4.0 statusbar加载icon
- 【Android4.0】SystemBar问题与StatusBar
- 如何隐藏Android4.0及以上版本的ActionBar、NotificationBar、StatusBar、SystemBar、TitleBar
- 如何隐藏Android4.0及以上版本的ActionBar、NotificationBar、StatusBar、SystemBar、TitleBar .
- 如何隐藏Android4.0及以上版本的ActionBar、NotificationBar、StatusBar、SystemBar、TitleBar
- 如何隐藏Android4.0及以上版本的ActionBar、NotificationBar、StatusBar、SystemBar、TitleBar
- android4.0.3隐藏statusbar
- Android4.0模拟器无法启动的解决方案
- Android4.0启动
- android4.0 开机启动
- 做了个屏保,学会了两个api函数
- R语言矩阵运算
- redis 分布式,主从同步
- 【专题】Web测试学习指南
- urlencode和文本编码
- android4.0 statusbar的启动
- web前端开发经验总结(个人笔记)
- 安装TestNG在eclipse中的插件
- Java程序实现冒泡排序、直接排序、插入排序方法
- hhc.exe制作chm
- JAVA设计模式二--Abstract Factory(抽象工厂)
- dsfd
- Windows下安装GTK+(整理)
- cpu周期(机器周期)