您的位置:首页 > 产品设计 > UI/UE

System server里创建常见的几个thread

2016-08-22 11:08 155 查看
android.ui :@WatchDog.java

// Add checker for shared UI thread.
mHandlerCheckers.add(new HandlerChecker(UiThread.getHandler(),
"ui thread", DEFAULT_TIMEOUT));

private UiThread() {
super("android.ui", android.os.Process.THREAD_PRIORITY_FOREGROUND, false );
}


static final long DEFAULT_TIMEOUT = DB ? 10*1000 : 60*1000; //默认为60s

主要处理:

1. AMS UiHandler里show各种msg

2. DisplayManagerService里的overlay相关msg

3. PointerEventDispatcher inputevent相关

4. VoiceInteractionManagerService Voice交互

5. WindowManagerPolicy init操作

android.bg BackgroundThread @AMS

final Handler mBgHandler = new Handler(BackgroundThread.getHandler().getLooper())
private BackgroundThread() {
super("android.bg", android.os.Process.THREAD_PRIORITY_BACKGROUND);
}


主要处理这两件事情:@mBgHandler.handleMessage()

CHECK_INTERNET_PERMISSION_MSG

COLLECT_PSS_BG_MSG

android.fg:@WatchDog.java

mMonitorChecker = new HandlerChecker(FgThread.getHandler(),
"foreground thread", DEFAULT_TIMEOUT);
private FgThread() {
super("android.fg", android.os.Process.THREAD_PRIORITY_DEFAULT, true /*allowIo*/);
}


主要用于:

1. AccountManagerService

2. BatteryStatsService

3. DreamManagerService

4. MountService

5. NetworkManagementService

6. PackageManagerService

7. usb相关(debug, device, portmanager)

8. WindowManagerService(screenshotApplicationsInner)

android.io: @WatchDog.java

mHandlerCheckers.add(new HandlerChecker(IoThread.getHandler(),
"i/o thread", DEFAULT_TIMEOUT));
private IoThread() {
super("android.io", android.os.Process.THREAD_PRIORITY_DEFAULT, true /*allowIo*/);
}


主要有用于:

1.BluetoothManagerService 相关操作

2.MountService里的obb操作

3.Tethering 网络共享(usb /wifi/mobile?)

4.TvInputManagerService tv里channel session相关

android.display:@WatchDog.java

mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(),
"display thread", DEFAULT_TIMEOUT));
private DisplayThread() {
super("android.display", android.os.Process.THREAD_PRIORITY_DISPLAY, false );
}


主要用于:

1. DisplayManagerService(display adapter,viewport ,event…)

2. InputManagerService (keyboard , input device …)

3. WindowManagerService 实例的创建

system server main thread:

mHandlerCheckers.add(new HandlerChecker(new Handler(Looper.getMainLooper()),
"main thread", DEFAULT_TIMEOUT));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ui android system server