- 浏览: 924696 次
- 性别:
- 来自: 上海
最新评论
-
liu149339750:
我勒个去,搜到你的博客了,关注!
Android make脚本简记 -
ihopethatwell:
楼主,这个修改时间有个问题,退出修改界面就不保存设置的时间了, ...
Android中如何修改系统时间(应用程序获得系统权限) -
flyar520:
你好...我也遇到屏幕半屏刷成黑屏的问题...但是我的时在开机 ...
Android横屏状态下返回到壁纸界面屏幕刷新问题 -
flyar520:
你好...我也遇到屏幕半屏刷成黑屏的问题...但是我的时在开机 ...
Android横屏状态下返回到壁纸界面屏幕刷新问题 -
taowayi:
推荐android一键反编译神器 apkdec
Android apk反编译
System Server是Android系统的核心,他在Dalvik虚拟机启动后立即开始初始化和运行。其它的系统服务在System Server进程的环境中运行。/base/services/java/com/android/server/SystemServer.java
- /**
- * This method is called from Zygote to initialize the system. This will cause the native
- * services (SurfaceFlinger, AudioFlinger, etc..) to be started. After that it will call back
- * up into init2() to start the Android services.
- */
- native public static void init1(String[] args);
- public static void main(String[] args) {
- if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) {
- // If a device's clock is before 1970 (before 0), a lot of
- // APIs crash dealing with negative numbers, notably
- // java.io.File#setLastModified, so instead we fake it and
- // hope that time from cell towers or NTP fixes it
- // shortly.
- Slog.w(TAG, "System clock is before 1970; setting to 1970." );
- SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
- }
- if (SamplingProfilerIntegration.isEnabled()) {
- SamplingProfilerIntegration.start();
- timer = new Timer();
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- SamplingProfilerIntegration.writeSnapshot("system_server" );
- }
- }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL);
- }
- // The system server has to run all of the time, so it needs to be
- // as efficient as possible with its memory usage.
- VMRuntime.getRuntime().setTargetHeapUtilization(0 .8f);
- System.loadLibrary("android_servers" );
- init1(args);
- }
- public static final void init2() {
- Slog.i(TAG, "Entered the Android system server!" );
- Thread thr = new ServerThread();
- thr.setName("android.server.ServerThread" );
- thr.start();
- }
在main函数中,首先检查系统时间设置和SamplingProfiler。然后加载一个叫android_servers的本地库,他提供本 地方法的接口(源程序在framework/base/services/jni/目录中)。然后调用本地方法设置服务。具体执行设置的代码在 frameworks/base/cmds/system_server/library/system_init.cpp中。
- extern "C" status_t system_init()
- {
- LOGI("Entered system_init()" );
- sp<ProcessState> proc(ProcessState::self());
- sp<IServiceManager> sm = defaultServiceManager();
- LOGI("ServiceManager: %p\n" , sm.get());
- sp<GrimReaper> grim = new GrimReaper();
- sm->asBinder()->linkToDeath(grim, grim.get(), 0);
- char propBuf[PROPERTY_VALUE_MAX];
- property_get("system_init.startsurfaceflinger" , propBuf, "1" );
- if (strcmp(propBuf, "1" ) == 0) {
- // Start the SurfaceFlinger
- SurfaceFlinger::instantiate();
- }
- // Start the sensor service
- SensorService::instantiate();
- // On the simulator, audioflinger et al don't get started the
- // same way as on the device, and we need to start them here
- if (!proc->supportsProcesses()) {
- // Start the AudioFlinger
- AudioFlinger::instantiate();
- // Start the media playback service
- MediaPlayerService::instantiate();
- // Start the camera service
- CameraService::instantiate();
- // Start the audio policy service
- AudioPolicyService::instantiate();
- }
- // And now start the Android runtime. We have to do this bit
- // of nastiness because the Android runtime initialization requires
- // some of the core system services to already be started.
- // All other servers should just start the Android runtime at
- // the beginning of their processes's main(), before calling
- // the init function.
- LOGI("System server: starting Android runtime.\n" );
- AndroidRuntime* runtime = AndroidRuntime::getRuntime();
- LOGI("System server: starting Android services.\n" );
- runtime->callStatic("com/android/server/SystemServer" , "init2" );
- // If running in our own process, just go into the thread
- // pool. Otherwise, call the initialization finished
- // func to let this process continue its initilization.
- if (proc->supportsProcesses()) {
- LOGI("System server: entering thread pool.\n" );
- ProcessState::self()->startThreadPool();
- IPCThreadState::self()->joinThreadPool();
- LOGI("System server: exiting thread pool.\n" );
- }
- return NO_ERROR;
- }
等初始化传感器,视频,音频等服务后,调用一个回调方法init2 (在SystemServer.java中)。在上面的代码可以看到,这个方法开启了ServerThread来初始化其它的服务。
- public void run() {
- EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN,
- SystemClock.uptimeMillis());
- Looper.prepare();
- android.os.Process.setThreadPriority(
- android.os.Process.THREAD_PRIORITY_FOREGROUND);
- BinderInternal.disableBackgroundScheduling(true );
- android.os.Process.setCanSelfBackground(false );
- // Check whether we failed to shut down last time we tried.
- {
- final String shutdownAction = SystemProperties.get(
- ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "" );
- if (shutdownAction != null && shutdownAction.length() > 0 ) {
- boolean reboot = (shutdownAction.charAt( 0 ) == '1' );
- final String reason;
- if (shutdownAction.length() > 1 ) {
- reason = shutdownAction.substring(1 , shutdownAction.length());
- } else {
- reason = null ;
- }
- ShutdownThread.rebootOrShutdown(reboot, reason);
- }
- }
- String factoryTestStr = SystemProperties.get("ro.factorytest" );
- int factoryTest = "" .equals(factoryTestStr) ? SystemServer.FACTORY_TEST_OFF
- : Integer.parseInt(factoryTestStr);
- LightsService lights = null ;
- PowerManagerService power = null ;
- BatteryService battery = null ;
- ConnectivityService connectivity = null ;
- IPackageManager pm = null ;
- Context context = null ;
- WindowManagerService wm = null ;
- BluetoothService bluetooth = null ;
- BluetoothA2dpService bluetoothA2dp = null ;
- HeadsetObserver headset = null ;
- DockObserver dock = null ;
- UsbService usb = null ;
- UiModeManagerService uiMode = null ;
- RecognitionManagerService recognition = null ;
- ThrottleService throttle = null ;
- // Critical services...
- try {
- Slog.i(TAG, "Entropy Service" );
- ServiceManager.addService("entropy" , new EntropyService());
- Slog.i(TAG, "Power Manager" );
- power = new PowerManagerService();
- ServiceManager.addService(Context.POWER_SERVICE, power);
- Slog.i(TAG, "Activity Manager" );
- context = ActivityManagerService.main(factoryTest);
- Slog.i(TAG, "Telephony Registry" );
- ServiceManager.addService("telephony.registry" , new TelephonyRegistry(context));
- AttributeCache.init(context);
- Slog.i(TAG, "Package Manager" );
- pm = PackageManagerService.main(context,
- factoryTest != SystemServer.FACTORY_TEST_OFF);
- ActivityManagerService.setSystemProcess();
- mContentResolver = context.getContentResolver();
- // The AccountManager must come before the ContentService
- try {
- Slog.i(TAG, "Account Manager" );
- ServiceManager.addService(Context.ACCOUNT_SERVICE,
- new AccountManagerService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Account Manager" , e);
- }
- Slog.i(TAG, "Content Manager" );
- ContentService.main(context,
- factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL);
- Slog.i(TAG, "System Content Providers" );
- ActivityManagerService.installSystemProviders();
- Slog.i(TAG, "Battery Service" );
- battery = new BatteryService(context);
- ServiceManager.addService("battery" , battery);
- Slog.i(TAG, "Lights Service" );
- lights = new LightsService(context);
- Slog.i(TAG, "Vibrator Service" );
- ServiceManager.addService("vibrator" , new VibratorService(context));
- // only initialize the power service after we have started the
- // lights service, content providers and the battery service.
- power.init(context, lights, ActivityManagerService.getDefault(), battery);
- Slog.i(TAG, "Alarm Manager" );
- AlarmManagerService alarm = new AlarmManagerService(context);
- ServiceManager.addService(Context.ALARM_SERVICE, alarm);
- Slog.i(TAG, "Init Watchdog" );
- Watchdog.getInstance().init(context, battery, power, alarm,
- ActivityManagerService.self());
- Slog.i(TAG, "Window Manager" );
- wm = WindowManagerService.main(context, power,
- factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL);
- ServiceManager.addService(Context.WINDOW_SERVICE, wm);
- ((ActivityManagerService)ServiceManager.getService("activity" ))
- .setWindowManager(wm);
- // Skip Bluetooth if we have an emulator kernel
- // TODO: Use a more reliable check to see if this product should
- // support Bluetooth - see bug 988521
- if (SystemProperties.get( "ro.kernel.qemu" ).equals( "1" )) {
- Slog.i(TAG, "Registering null Bluetooth Service (emulator)" );
- ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, null );
- } else if (factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) {
- Slog.i(TAG, "Registering null Bluetooth Service (factory test)" );
- ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, null );
- } else {
- Slog.i(TAG, "Bluetooth Service" );
- bluetooth = new BluetoothService(context);
- ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, bluetooth);
- bluetooth.initAfterRegistration();
- bluetoothA2dp = new BluetoothA2dpService(context, bluetooth);
- ServiceManager.addService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE,
- bluetoothA2dp);
- int bluetoothOn = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.BLUETOOTH_ON, 0 );
- if (bluetoothOn > 0 ) {
- bluetooth.enable();
- }
- }
- } catch (RuntimeException e) {
- Slog.e("System" , "Failure starting core service" , e);
- }
- DevicePolicyManagerService devicePolicy = null ;
- StatusBarManagerService statusBar = null ;
- InputMethodManagerService imm = null ;
- AppWidgetService appWidget = null ;
- NotificationManagerService notification = null ;
- WallpaperManagerService wallpaper = null ;
- LocationManagerService location = null ;
- if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
- try {
- Slog.i(TAG, "Device Policy" );
- devicePolicy = new DevicePolicyManagerService(context);
- ServiceManager.addService(Context.DEVICE_POLICY_SERVICE, devicePolicy);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting DevicePolicyService" , e);
- }
- 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);
- }
- try {
- Slog.i(TAG, "Clipboard Service" );
- ServiceManager.addService(Context.CLIPBOARD_SERVICE,
- new ClipboardService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Clipboard Service" , e);
- }
- try {
- Slog.i(TAG, "Input Method Service" );
- imm = new InputMethodManagerService(context, statusBar);
- ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Input Manager Service" , e);
- }
- try {
- Slog.i(TAG, "NetStat Service" );
- ServiceManager.addService("netstat" , new NetStatService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetStat Service" , e);
- }
- try {
- Slog.i(TAG, "NetworkManagement Service" );
- ServiceManager.addService(
- Context.NETWORKMANAGEMENT_SERVICE,
- NetworkManagementService.create(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetworkManagement Service" , e);
- }
- try {
- Slog.i(TAG, "Connectivity Service" );
- connectivity = ConnectivityService.getInstance(context);
- ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Connectivity Service" , e);
- }
- try {
- Slog.i(TAG, "Throttle Service" );
- throttle = new ThrottleService(context);
- ServiceManager.addService(
- Context.THROTTLE_SERVICE, throttle);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting ThrottleService" , e);
- }
- try {
- Slog.i(TAG, "Accessibility Manager" );
- ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,
- new AccessibilityManagerService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Accessibility Manager" , e);
- }
- try {
- /*
- * NotificationManagerService is dependant on MountService,
- * (for media / usb notifications) so we must start MountService first.
- */
- Slog.i(TAG, "Mount Service" );
- ServiceManager.addService("mount" , new MountService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Mount Service" , e);
- }
- try {
- Slog.i(TAG, "Notification Manager" );
- notification = new NotificationManagerService(context, statusBar, lights);
- ServiceManager.addService(Context.NOTIFICATION_SERVICE, notification);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Notification Manager" , e);
- }
- try {
- Slog.i(TAG, "Device Storage Monitor" );
- ServiceManager.addService(DeviceStorageMonitorService.SERVICE,
- new DeviceStorageMonitorService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting DeviceStorageMonitor service" , e);
- }
- try {
- Slog.i(TAG, "Location Manager" );
- location = new LocationManagerService(context);
- ServiceManager.addService(Context.LOCATION_SERVICE, location);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Location Manager" , e);
- }
- try {
- Slog.i(TAG, "Search Service" );
- ServiceManager.addService(Context.SEARCH_SERVICE,
- new SearchManagerService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Search Service" , e);
- }
- if (INCLUDE_DEMO) {
- Slog.i(TAG, "Installing demo data..." );
- (new DemoThread(context)).start();
- }
- try {
- Slog.i(TAG, "DropBox Service" );
- ServiceManager.addService(Context.DROPBOX_SERVICE,
- new DropBoxManagerService(context, new File( "/data/system/dropbox" )));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting DropBoxManagerService" , e);
- }
- try {
- Slog.i(TAG, "Wallpaper Service" );
- wallpaper = new WallpaperManagerService(context);
- ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Wallpaper Service" , e);
- }
- try {
- Slog.i(TAG, "Audio Service" );
- ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Audio Service" , e);
- }
- try {
- Slog.i(TAG, "Headset Observer" );
- // Listen for wired headset changes
- headset = new HeadsetObserver(context);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting HeadsetObserver" , e);
- }
- try {
- Slog.i(TAG, "Dock Observer" );
- // Listen for dock station changes
- dock = new DockObserver(context, power);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting DockObserver" , e);
- }
- try {
- Slog.i(TAG, "USB Service" );
- // Listen for USB changes
- usb = new UsbService(context);
- ServiceManager.addService(Context.USB_SERVICE, usb);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting UsbService" , e);
- }
- try {
- Slog.i(TAG, "UI Mode Manager Service" );
- // Listen for UI mode changes
- uiMode = new UiModeManagerService(context);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting UiModeManagerService" , e);
- }
- try {
- Slog.i(TAG, "Backup Service" );
- ServiceManager.addService(Context.BACKUP_SERVICE,
- new BackupManagerService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Backup Service" , e);
- }
- try {
- Slog.i(TAG, "AppWidget Service" );
- appWidget = new AppWidgetService(context);
- ServiceManager.addService(Context.APPWIDGET_SERVICE, appWidget);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting AppWidget Service" , e);
- }
- try {
- Slog.i(TAG, "Recognition Service" );
- recognition = new RecognitionManagerService(context);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Recognition Service" , e);
- }
- try {
- Slog.i(TAG, "DiskStats Service" );
- ServiceManager.addService("diskstats" , new DiskStatsService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting DiskStats Service" , e);
- }
- }
- // make sure the ADB_ENABLED setting value matches the secure property value
- Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_ENABLED,
- "1" .equals(SystemProperties.get( "persist.service.adb.enable" )) ? 1 : 0 );
- // register observer to listen for settings changes
- mContentResolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
- false , new AdbSettingsObserver());
- // Before things start rolling, be sure we have decided whether
- // we are in safe mode.
- final boolean safeMode = wm.detectSafeMode();
- if (safeMode) {
- try {
- ActivityManagerNative.getDefault().enterSafeMode();
- // Post the safe mode state in the Zygote class
- Zygote.systemInSafeMode = true ;
- // Disable the JIT for the system_server process
- VMRuntime.getRuntime().disableJitCompilation();
- } catch (RemoteException e) {
- }
- } else {
- // Enable the JIT for the system_server process
- VMRuntime.getRuntime().startJitCompilation();
- }
- // It is now time to start up the app processes...
- if (devicePolicy != null ) {
- devicePolicy.systemReady();
- }
- if (notification != null ) {
- notification.systemReady();
- }
- if (statusBar != null ) {
- statusBar.systemReady();
- }
- wm.systemReady();
- power.systemReady();
- try {
- pm.systemReady();
- } catch (RemoteException e) {
- }
- // These are needed to propagate to the runnable below.
- final StatusBarManagerService statusBarF = statusBar;
- final BatteryService batteryF = battery;
- final ConnectivityService connectivityF = connectivity;
- final DockObserver dockF = dock;
- final UsbService usbF = usb;
- final ThrottleService throttleF = throttle;
- final UiModeManagerService uiModeF = uiMode;
- final AppWidgetService appWidgetF = appWidget;
- final WallpaperManagerService wallpaperF = wallpaper;
- final InputMethodManagerService immF = imm;
- final RecognitionManagerService recognitionF = recognition;
- final LocationManagerService locationF = location;
- // We now tell the activity manager it is okay to run third party
- // code. It will call back into us once it has gotten to the state
- // where third party code can really run (but before it has actually
- // started launching the initial applications), for us to complete our
- // initialization.
- ((ActivityManagerService)ActivityManagerNative.getDefault())
- .systemReady(new Runnable() {
- public void run() {
- Slog.i(TAG, "Making services ready" );
- if (statusBarF != null ) statusBarF.systemReady2();
- if (batteryF != null ) batteryF.systemReady();
- if (connectivityF != null ) connectivityF.systemReady();
- if (dockF != null ) dockF.systemReady();
- if (usbF != null ) usbF.systemReady();
- if (uiModeF != null ) uiModeF.systemReady();
- if (recognitionF != null ) recognitionF.systemReady();
- Watchdog.getInstance().start();
- // It is now okay to let the various system services start their
- // third party code...
- if (appWidgetF != null ) appWidgetF.systemReady(safeMode);
- if (wallpaperF != null ) wallpaperF.systemReady();
- if (immF != null ) immF.systemReady();
- if (locationF != null ) locationF.systemReady();
- if (throttleF != null ) throttleF.systemReady();
- }
- });
- // For debug builds, log event loop stalls to dropbox for analysis.
- if (StrictMode.conditionallyEnableDebugLogging()) {
- Slog.i(TAG, "Enabled StrictMode for system server main thread." );
- }
- Looper.loop();
- Slog.d(TAG, "System ServerThread is exiting!" );
- }
这里启动的没一个进程都作为一个Dalvik线程而存在于SystemServer进程里面。
发表评论
-
Android systrace
2018-09-12 11:13 1039Understanding Systrace Caution: ... -
Android simpleperf
2018-09-12 11:02 1953Introduction of simpleperf What ... -
Android selinux安全策略
2016-06-21 17:16 4112基础知识 SEAndroid在架构和机制上与SELinux完 ... -
Android wifi captive portal 验证
2016-02-23 20:38 5204只要是国内的用户,基本上刷完5.0版本后如果没挂上V P N, ... -
Android CTS windows环境下测试
2015-09-08 11:36 6460Windows下CTS测试步骤 1.获 ... -
Android 之 日期时间 时区同步
2015-05-13 15:47 6376系统设置--日期和时间-- ... -
虚拟按键 振动效果
2015-05-12 11:50 2129[DESCRIPTION] Setting->情景模式- ... -
Android 签名信息读取
2014-08-22 17:32 1386public void getSingInfo() { ... -
Android UiAutomator 自动化测试
2014-07-04 17:39 10009一、一个BUG引发的问题 ... -
Android 多语言 多地区对应表
2014-05-13 17:09 2153Arabic, Egypt (ar_EG) Arabic, ... -
Android emulated sdcard
2013-08-12 21:46 6172如果要添加 emulated sdcard ,需要一下几个 ... -
#if、#ifdef、#if defined之间的区别
2013-05-17 15:19 58475#if的使用说明 #if的后面接的是表达式 #if ( ... -
Android 动态库死机调试方法
2013-03-05 13:54 4879android系统中调试Java非常容易,一般遇到错误都在 ... -
Android sqlite3 详解
2012-09-13 22:13 2409SQLite库包含一个名字叫做sqlite3的命令行,它可以让 ... -
Android 多语言开发
2012-08-16 18:37 2411第一部分 多语言定制的机制 1、ICU4C简介 ICU4 ... -
Android 添加底层核心服务
2012-06-04 10:52 5821为 Android添加底层核 ... -
Android 之响应的系统设置的事件
2012-05-24 18:17 19811、Configuration类专门用于描述手机设备上的配置信 ... -
Android CRT Screen 电视效果
2012-05-17 11:12 2313Android 2.3 对关屏进行了优化,增加了一种类似于 ... -
android编译dex-preopt
2012-05-11 18:48 5444对于android2.3编译时候选择下面的情况,既可以对dex ... -
Android 移动终端camera 防偷*拍设置
2012-04-26 10:35 1897目前市面上的所有移动终端几乎都有camera应用,但andro ...
相关推荐
### Android Zygote启动流程源码解析 #### 引言 在Android系统中,Zygote进程扮演着至关重要的角色,作为所有应用进程和SystemServer进程的“始祖”。了解Zygote的启动流程对于深入理解Android底层机制具有重要...
### Android系统从init进程开始到systemserver启动详细流程 #### 1. 概述 在Android系统的启动过程中,从Linux内核加载完成后,系统将执行第一个用户空间进程——`init`进程,它作为后续所有进程的父进程。`init`...
12.init脚本解析分析 13.init脚本执行和进程守护(1) 14.init脚本执行和进程守护(2) 15.android服务介绍与davlink启动 16.Zygote剖析与system_server启动 17.Zygote创建APP分析 18.zygote_load系统资源分析及优化 19....
在深入解析Android蓝牙初始化代码之前,先来了解一下蓝牙的整体架构。 蓝牙整体架构包括蓝牙系统apk、JNI、Framework、Bluedroid协议栈和硬件厂商提供的模块。蓝牙系统apk位于packages/app/Bluetooth,它打包成一个...
### System Server启动详解 ...通过对关键步骤的深入解析,我们可以更全面地理解`SystemServer`在整个Android系统中的重要性和运作原理。这对于Android开发人员来说至关重要,有助于更好地优化应用性能和资源管理。
`SystemServer`是Android服务框架的中心,它在`SystemServer.java`中初始化并创建了一系列的系统服务,如`ActivityManagerService`、`PackageManagerService`等,并将它们注册到`servicemanager`中,供其他组件调用...
本文将对每个阶段进行详细解析,帮助读者更好地理解Android系统的启动流程。 #### 二、init进程启动 **init进程**是Android启动的第一个用户级进程,由内核直接启动。它的主要职责是读取配置文件`init.rc`及平台...
5. **Native Service**: Native Service是Android底层服务的重要组成部分,课程将深入解析如何使用IInterface(Java与C++的结合),BnInterface与BpInterface的运用,以及如何实现Native Service和Native Binder ...
本书以情景化的方式,对Android的源代码进行了细致入微的解读,尤其侧重于Framework层的解析,同时兼顾了Native层和Application层的探讨,确保了内容的广度和深度。 ### 重要知识点概览 #### 1. Android系统架构和...
本笔记将从以下几个方面对 Android 源码进行解析: 1. **Android 架构概述** Android 系统由五大部分组成:Linux 内核、HAL(硬件抽象层)、系统库、应用程序框架和应用程序。其中,Linux 内核提供底层硬件支持,...
9. **UI布局解析**:XML布局文件如何转换为Android视图树,源码解释了LayoutInflater的角色。 10. **系统启动过程**:了解Zygote进程如何孵化新的应用进程,以及SystemServer如何启动和管理整个系统的运行。 总之...
第4章分析了Zygote、SystemServer等进程的工作机制,同时还讨论了Android的启动速度、虚拟机HeapSize的大小调整、Watchdog工作原理等问题;第5章讲解了Android系统中常用的类,包括sp、wp、RefBase、Thread等类,...
本文将详细解析如何在Android应用层通过编程实现这一目标,并结合提供的"android实现关机和重启"源码进行分析。 首先,我们要明白在Android中,应用程序通常没有足够的权限直接执行关机或重启操作。这是因为这些...
- **启动SystemServer**:`zygote` 启动`SystemServer` 进程,这是Android服务的核心。 - **处理应用请求**:通过`zygote` socket接收来自`ActivityManagerService` 的请求,分叉出新的应用进程。 #### 四、...
通过对Zygote启动流程以及systemServer和Home Activity启动过程的详细解析,我们不仅了解了Android系统启动过程中的关键步骤和技术细节,还深入了解了ART虚拟机的工作原理。这些深入的理解对于开发者来说至关重要,...
Android启动过程详解主要分为四个关键步骤,这四个步骤构建了Android系统的基石。下面将详细阐述这些步骤以及涉及的重要组件。 第一步:初始化init进程 init进程是Android系统启动的第一个用户级进程,由Linux内核...
《安卓Android源码解析——聚焦Pax》 在深入探讨Android源码之前,我们首先要明白,Android是一个开源的操作系统,其源代码公开发布,允许开发者对其进行定制和改进。这一特性使得Android成为全球开发者广泛研究的...
本文将深入解析Android开机启动的源代码,帮助读者理解这一过程的关键环节。 首先,Android系统的启动始于硬件层面的Bootloader。Bootloader是设备上电后执行的第一段程序,它负责加载kernel(内核)到内存中并启动...