Android 源码分析 - 系统 - systemserver

        源代码位于:

frameworks/base/services/java/com/android/server/SystemServer.java。

frameworks/base/services/jni/com_android_server_SystemServer.cpp。

  • Android FactoryTest框架
    • factoryTest
      1. SystemProperties.get("ro.factorytest")
      2. FACTORY_TEST_OFF
      3. FACTORY_TEST_LOW_LEVEL
      4. FACTORY_TEST_HIGH_LEVEL

boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false);

boolean disableMedia = SystemProperties.getBoolean("config.disable_media", false);

boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false);

boolean disableTelephony = SystemProperties.getBoolean("config.disable_telephony", false);

boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);

boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false);

boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);

boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);

流程

  1. System.loadLibrary("android_servers")(加载lib android_servers库)
  2. nativeInit
    1. 初始化native服务
  3. ServerThread thr = new ServerThread()
  4. thr.initAndLoop()
    1. new HandlerThread("WindowManager")
    2. installer = new Installer
    3. installer.ping()
    4. AttributeCache.init
    5. display.waitForDefaultDisplay
    6. firstBoot = pm.isFirstBoot
    7. ActivityManagerService.setSystemProcess
    8. ActivityManagerService.installSystemProviders
    9. Watchdog.getInstance().init
    10. Watchdog.getInstance().addThread(wmHandler, "WindowManager thread")
    11. ActivityManagerService.self().setWindowManager
    12. inputManager.setWindowManagerCallbacks(wm.getInputMonitor())
    13. display.setWindowManager
    14. display.setInputManager
    15. wm.displayReady
    16. ActivityManagerNative.getDefault().showBootMessage
    17. mountService.waitForAsecScan
    18. contentService.systemReady
    19. dock = new DockObserver
    20. inputManager.setWiredAccessoryCallbacks(new WiredAccessoryManager)
    21. wm.detectSafeMode
      1. ActivityManagerService.self().enterSafeMode
      2. VMRuntime.getRuntime().disableJitCompilation
    22. 调用服务的systemReady
    23. 调用服务的systemRunning
    24. Looper.loop

服务

名称

类名

依赖

说明

power

PowerManagerService

lights

activity

batterystats

appops

activity

ActivityManagerService

factoryTest

window

batterystats

BatteryStatsService

在ActivityManagerService构造时创建

usagestats

UsageStatsService

procstats

ProcessStatsService

activity

appops

AppOpsService

display

DisplayManagerService

wmHandler

window

input

telephony.registry

TelephonyRegistry

scheduling_policy

SchedulingPolicyService

package

PackageManagerService

installer

factoryTest

onlyCore

meminfo

MemBinder

activity

在ActivityManagerService的setSystemProcess方法中创建

gfxinfo

GraphicsBinder

activity

dbinfo

DbBinder

activity

cpuinfo

CpuBinder

activity

permission

PermissionController

activity

entropy

EntropyMixer

user

UserManagerService

account

AccountManagerService

content

ContentService

factoryTest

LightsService

battery

BatteryService

vibrator

VibratorService

consumer_ir

ConsumerIrService

alarm

AlarmManagerService

input

InputManagerService

wmHandler

window

WindowManagerService

power

display

input

wmHandler

factoryTest

firstBoot

onlyCore

bluetooth_manager

BluetoothManagerService

input_method

InputMethodManagerService

accessibility

AccessibilityManagerService

mount

MountService

lock_settings

LockSettingsService

device_policy

DevicePolicyManagerService

statusbar

StatusBarManagerService

clipboard

ClipboardService

network_management

NetworkManagementService

textservices

TextServicesManagerService

netstats

NetworkStatsService

connectivity

netpolicy

NetworkPolicyManagerService

connectivity

wifip2p

WifiP2pService

wifi

WifiService

connectivity

ConnectivityService

network_management

netstats

netpolicy

servicediscovery

NsdService

updatelock

UpdateLockService

notification

NotificationManagerService

devicestoragemonitor

DeviceStorageMonitorService

location

LocationManagerService

country_detector

CountryDetectorService

search

SearchManagerService

dropbox

DropBoxManagerService

wallpaper

WallpaperManagerService

audio

AudioService

usb

UsbService

TwilightService

UiModeManagerService

twilight

backup

BackupManagerService

appwidget

AppWidgetService

RecognitionManagerService

diskstats

DiskStatsService

samplingprofiler

SamplingProfilerService

NetworkTimeUpdateService

commontime_management

CommonTimeManagementService

CertBlacklister

dreams

DreamManagerService

assetatlas

AssetAtlasService

IdleMaintenanceService

battery

print

PrintManagerService

media_router

MediaRouterService

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fighting Horse

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值