9.0 多了很多hal层的独立集成,如
console:/ # ps -A USER PID PPID VSZ RSS WCHAN ADDR S NAME root 1 0 16128 1372 SyS_epoll_wait 0 S init root 2 0 0 0 kthreadd 0 S [kthreadd] root 3 2 0 0 smpboot_thread_fn 0 S [ksoftirqd/0] root 5 2 0 0 worker_thread 0 S [kworker/0:0H] root 7 2 0 0 rcu_gp_kthread 0 S [rcu_preempt] root 8 2 0 0 rcu_gp_kthread 0 S [rcu_sched] root 9 2 0 0 rcu_gp_kthread 0 S [rcu_bh] root 10 2 0 0 smpboot_thread_fn 0 S [migration/0] root 11 2 0 0 rescuer_thread 0 S [lru-add-drain] root 12 2 0 0 smpboot_thread_fn 0 S [watchdog/0] root 13 2 0 0 smpboot_thread_fn 0 S [cpuhp/0] root 14 2 0 0 smpboot_thread_fn 0 S [cpuhp/1] root 15 2 0 0 smpboot_thread_fn 0 S [watchdog/1] root 16 2 0 0 smpboot_thread_fn 0 S [migration/1] root 17 2 0 0 smpboot_thread_fn 0 S [ksoftirqd/1] root 19 2 0 0 worker_thread 0 S [kworker/1:0H] root 20 2 0 0 smpboot_thread_fn 0 S [cpuhp/2] root 21 2 0 0 smpboot_thread_fn 0 S [watchdog/2] root 22 2 0 0 smpboot_thread_fn 0 S [migration/2] root 23 2 0 0 smpboot_thread_fn 0 S [ksoftirqd/2] root 25 2 0 0 worker_thread 0 S [kworker/2:0H] root 26 2 0 0 smpboot_thread_fn 0 S [cpuhp/3] root 27 2 0 0 smpboot_thread_fn 0 S [watchdog/3] root 28 2 0 0 smpboot_thread_fn 0 S [migration/3] root 29 2 0 0 smpboot_thread_fn 0 S [ksoftirqd/3] root 31 2 0 0 worker_thread 0 S [kworker/3:0H] root 32 2 0 0 devtmpfsd 0 S [kdevtmpfs] root 1328 2 0 0 watchdog 0 S [khungtaskd] root 1329 2 0 0 oom_reaper 0 S [oom_reaper] root 1330 2 0 0 rescuer_thread 0 S [writeback] root 1332 2 0 0 kcompactd 0 S [kcompactd0] root 1333 2 0 0 rescuer_thread 0 S [crypto] root 1334 2 0 0 rescuer_thread 0 S [bioset] root 1336 2 0 0 rescuer_thread 0 S [kblockd] root 1364 2 0 0 rescuer_thread 0 S [md] root 1370 2 0 0 rescuer_thread 0 S [devfreq_wq] root 1379 2 0 0 rescuer_thread 0 S [lcd_work_queue] root 1405 2 0 0 rescuer_thread 0 S [cfg80211] root 1409 2 0 0 rescuer_thread 0 S [watchdogd] root 1493 2 0 0 down_interruptible 0 S [gp_pll] root 1546 2 0 0 kswapd 0 S [kswapd0] root 1547 2 0 0 rescuer_thread 0 S [vmstat] root 1606 2 0 0 rescuer_thread 0 S [SquashFS read w] root 1616 2 0 0 ecryptfs_threadfn 0 S [ecryptfs-kthrea] root 1618 2 0 0 rescuer_thread 0 S [cifsiod] root 1619 2 0 0 rescuer_thread 0 S [cifsoplockd] root 1742 2 0 0 add_hwgenerator_randomness 0 S [hwrng] root 1746 2 0 0 rescuer_thread 0 S [bioset] root 1749 2 0 0 rescuer_thread 0 S [bioset] root 1752 2 0 0 rescuer_thread 0 S [bioset] root 1755 2 0 0 rescuer_thread 0 S [bioset] root 1758 2 0 0 rescuer_thread 0 S [bioset] root 1762 2 0 0 rescuer_thread 0 S [bioset] root 1765 2 0 0 rescuer_thread 0 S [bioset] root 1768 2 0 0 rescuer_thread 0 S [bioset] root 1773 2 0 0 rescuer_thread 0 S [bioset] root 1800 2 0 0 rescuer_thread 0 S [eth_moniter_tx_] root 1852 2 0 0 rescuer_thread 0 S [dm_bufio_cache] root 1853 2 0 0 cpufreq_interactive_speedchange_task 0 S [cfinteractive] root 1894 2 0 0 rescuer_thread 0 S [ffd13000.spicc] root 1934 2 0 0 do_null_task 0 S [null] root 1935 2 0 0 cpu_hotplug_thread 0 S [cpu_hogplug_thr] root 1948 2 0 0 ion_heap_deferred_free 0 S [vmalloc_ion] root 1949 2 0 0 ion_heap_deferred_free 0 S [codec_mm_ion] root 1953 2 0 0 down_interruptible 0 S [ge2d_monitor] root 1968 2 0 0 down_interruptible 0 S [kthread_di] root 1985 2 0 0 rescuer_thread 0 S [hdmirx] root 1986 2 0 0 rescuer_thread 0 S [hdmirx] root 2025 2 0 0 videosync_thread 0 D [videosync] root 2036 2 0 0 irq_thread 0 S [irq/55-meson-am] root 2051 2 0 0 rescuer_thread 0 S [cec_work] root 2080 2 0 0 irq_thread 0 S [irq/32-meson-g1] root 2085 2 0 0 cma_boost_work_func 0 S [cma_task0] root 2086 2 0 0 cma_boost_work_func 0 S [cma_task1] root 2087 2 0 0 cma_boost_work_func 0 S [cma_task2] root 2088 2 0 0 cma_boost_work_func 0 S [cma_task3] root 2164 2 0 0 rescuer_thread 0 S [ipv6_addrconf] root 2175 2 0 0 wait_woken 0 S [krfcommd] root 2188 2 0 0 rescuer_thread 0 S [bioset] root 2189 2 0 0 mmc_start_req 0 S [mmcqd/0] root 2190 2 0 0 rescuer_thread 0 S [bioset] root 2191 2 0 0 mmc_queue_thread 0 S [mmcqd/0boot0] root 2192 2 0 0 rescuer_thread 0 S [bioset] root 2193 2 0 0 mmc_queue_thread 0 S [mmcqd/0boot1] root 2194 2 0 0 rescuer_thread 0 S [bioset] root 2195 2 0 0 mmc_queue_thread 0 S [mmcqd/0rpmb] root 2254 2 0 0 rescuer_thread 0 S [bl_power_on_que] root 2264 2 0 0 rescuer_thread 0 S [bioset] root 2267 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 2438 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 2439 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 2440 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 2441 1 3044 508 poll_schedule_timeout 0 S init root 2442 1 2788 488 poll_schedule_timeout 0 S init root 2443 1 3428 852 poll_schedule_timeout 0 S ueventd root 2544 2 0 0 rescuer_thread 0 S [kbase_job_fault] root 2580 1 5312 2652 hrtimer_nanosleep 0 S vadservice root 2971 1 31400 9300 binder_thread_read 0 S imageserver root 2972 1 7144 2876 binder_thread_read 0 S miracast_hdcp2 root 2975 2 0 0 worker_thread 0 S [kworker/1:1H] root 2978 2 0 0 worker_thread 0 S [kworker/2:1H] root 2981 2 0 0 worker_thread 0 S [kworker/3:1H] root 2991 2 0 0 kjournald2 0 S [jbd2/mmcblk0p20] root 2992 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 2998 2 0 0 kjournald2 0 S [jbd2/mmcblk0p3-] root 2999 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 3003 2 0 0 kjournald2 0 S [jbd2/mmcblk0p13] root 3004 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 3008 2 0 0 kjournald2 0 S [jbd2/mmcblk0p10] root 3009 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 3011 2 0 0 kjournald2 0 S [jbd2/mmcblk0p15] root 3012 2 0 0 rescuer_thread 0 S [ext4-rsv-conver] root 3019 2 0 0 irq_thread 0 S [irq/59-vdec-0] root 3020 2 0 0 irq_thread 0 S [irq/60-vdec-1] root 3021 2 0 0 down_interruptible 0 S [vdec-core] root 3022 2 0 0 rescuer_thread 0 S [vdec-work] logd 3091 1 12880 4216 sigsuspend 0 S logd system 3092 1 5956 2832 binder_thread_read 0 S servicemanager system 3093 1 8644 4024 binder_thread_read 0 S hwservicemanager system 3094 1 6424 2548 binder_thread_read 0 S vndservicemanager system 3095 1 8876 3056 binder_thread_read 0 S android.hardware.keymaster@3.0-service root 3097 1 17496 4764 binder_thread_read 0 S vold root 3102 2 0 0 kauditd_thread 0 S [kauditd] root 3181 1 32596 5308 binder_thread_read 0 S netd root 3182 1 1280452 79908 poll_schedule_timeout 0 S zygote root 3184 1 16292 3516 binder_thread_read 0 S hdmicecd root 3185 1 10640 3016 binder_thread_read 0 S rc_server root 3186 1 26304 6336 binder_thread_read 0 S systemcontrol system 3187 1 6772 2888 binder_thread_read 0 S android.hidl.allocator@1.0-service audioserver 3188 1 49932 13972 binder_thread_read 0 S android.hardware.audio@2.0-service bluetooth 3189 1 11172 3080 binder_thread_read 0 S android.hardware.bluetooth@1.0-service cameraserver 3190 1 16540 3480 binder_thread_read 0 S android.hardware.camera.provider@2.4-service media 3191 1 9924 3112 binder_thread_read 0 S android.hardware.cas@1.0-service system 3193 1 9708 3100 binder_thread_read 0 S android.hardware.configstore@1.1-service media 3195 1 11068 3172 binder_thread_read 0 S android.hardware.drm@1.0-service media 3196 1 10916 2964 binder_thread_read 0 S android.hardware.drm@1.1-service.clearkey media 3197 1 13528 3112 binder_thread_read 0 S android.hardware.drm@1.1-service.widevine system 3198 1 8320 3064 binder_thread_read 0 S android.hardware.gatekeeper@1.0-service system 3199 1 15492 5588 binder_thread_read 0 S android.hardware.graphics.allocator@2.0-service system 3200 1 71048 6320 binder_thread_read 0 S android.hardware.graphics.composer@2.2-service system 3201 1 7636 3256 SyS_epoll_wait 0 S android.hardware.health@2.0-service system 3202 1 7500 3080 binder_thread_read 0 S android.hardware.light@2.0-service system 3203 1 7528 3220 binder_thread_read 0 S android.hardware.memtrack@1.0-service system 3204 1 7692 3184 binder_thread_read 0 S android.hardware.power@1.0-service system 3205 1 7540 3084 binder_thread_read 0 S android.hardware.thermal@1.0-service system 3206 1 7752 2944 binder_thread_read 0 S android.hardware.tv.cec@1.0-service system 3207 1 10744 3844 binder_thread_read 0 S android.hardware.tv.input@1.0-service root 3208 3181 4936 2144 pipe_wait 0 S iptables-restore system 3209 1 8464 2968 binder_thread_read 0 S android.hardware.usb@1.0-service root 3210 3181 4944 2168 pipe_wait 0 S ip6tables-restore wifi 3212 1 10396 3604 binder_thread_read 0 S android.hardware.wifi@1.0-service audioserver 3213 1 49292 9732 binder_thread_read 0 S audioserver root 3214 1 5068 2224 SyS_epoll_wait 0 S lmkd system 3215 1 111140 23520 SyS_epoll_wait 0 S surfaceflinger system 3216 1 9576 3412 binder_thread_read 0 S thermalserviced root 3217 1 6780 2596 __skb_wait_for_more_packets 0 S admind root 3219 1 24828 4056 binder_thread_read 0 S tvserver root 3252 2 0 0 rescuer_thread 0 S [f_mtp] root 3270 2 0 0 worker_thread 0 S [kworker/0:1H] root 3275 1 4568 2276 sigsuspend 0 S sh cameraserver 3278 1 25176 7012 binder_thread_read 0 S cameraserver drm 3279 1 18788 6828 binder_thread_read 0 S drmserver incidentd 3280 1 10672 3484 SyS_epoll_wait 0 S incidentd root 3281 1 15648 4384 binder_thread_read 0 S installd keystore 3282 1 13008 3920 binder_thread_read 0 S keystore media 3283 1 10616 3608 binder_thread_read 0 S mediadrmserver mediaex 3284 1 71156 11720 binder_thread_read 0 S media.extractor media 3285 1 18716 6992 binder_thread_read 0 S media.metrics media 3286 1 107576 12456 binder_thread_read 0 S mediaserver statsd 3290 1 12732 3888 SyS_epoll_wait 0 S statsd root 3291 1 14864 4100 binder_thread_read 0 S storaged wifi 3292 1 10816 4196 SyS_epoll_wait 0 S wificond root 3294 1 5804 2396 unix_stream_read_generic 0 S systemcleand mediacodec 3296 1 59704 8984 binder_thread_read 0 S media.codec root 3297 1 5524 2764 hrtimer_nanosleep 0 S hdcp_rx22 system 3299 1 11224 3924 binder_thread_read 0 S gatekeeperd tombstoned 3300 1 4988 1868 SyS_epoll_wait 0 S tombstoned root 3319 2 0 0 rescuer_thread 0 S [kbase_event] root 3473 2 0 0 kthread_worker_fn 0 S [aml_buf_toggle_] system 3474 3182 1478600 129832 SyS_epoll_wait 0 S system_server u0_a6 3804 3182 1213648 139576 SyS_epoll_wait 0 S com.pptv.systemui bluetooth 3834 3182 1140088 70840 SyS_epoll_wait 0 S com.android.bluetooth webview_zygote 3869 3182 1282544 49156 poll_schedule_timeout 0 S webview_zygote system 3884 3182 1106956 68008 SyS_epoll_wait 0 S com.droidlogic.tvinput system 3915 3182 1101748 62704 SyS_epoll_wait 0 S com.droidlogic system 3937 3182 1108936 66616 SyS_epoll_wait 0 S com.android.tv.settings root 4016 2 0 0 rescuer_thread 0 S [kbase_event] root 4056 2 0 0 main_thread 0 S [main_thread] root 4057 2 0 0 hif_thread 0 S [hif_thread] root 4058 2 0 0 rx_thread 0 S [rx_thread] u0_a8 4062 3182 1092808 52532 SyS_epoll_wait 0 S android.ext.services root 4071 1 40044 13584 binder_thread_read 0 S screencontrol wifi 4122 1 11604 4108 poll_schedule_timeout 0 S wpa_supplicant u0_a9 4230 3182 1093348 56180 SyS_epoll_wait 0 S com.android.providers.tv system 4238 3182 1117256 65736 SyS_epoll_wait 0 S com.pptv.framework.tvservice system 4268 3182 1100984 64092 SyS_epoll_wait 0 S com.pptv.terminalmanager secure_element 4281 3182 1094048 47872 SyS_epoll_wait 0 S com.android.se system 4296 3182 1144980 110660 SyS_epoll_wait 0 S com.pptv.tv system 4308 3182 1282820 170544 SyS_epoll_wait 0 S com.pptv.voicecontroller system 4327 3182 1095104 46828 SyS_epoll_wait 0 S com.pptv.push.service system 4341 3182 1142552 75604 SyS_epoll_wait 0 S com.pptv.snisservice u0_a1 4376 3182 1097460 56428 SyS_epoll_wait 0 S android.process.media system 4413 3182 1093876 51888 SyS_epoll_wait 0 S com.android.keychain system 4455 3182 1104936 63056 SyS_epoll_wait 0 S com.pptv.framework.tvservice:provider u0_a34 4502 3182 1142316 83540 SyS_epoll_wait 0 S com.dianshijia.newlive u0_a32 4595 3182 1396664 81568 SyS_epoll_wait 0 S com.pptv.usercenter system 4697 3182 1118740 69036 SyS_epoll_wait 0 S com.pptv.setting:provider system 4711 3182 1873412 452880 SyS_epoll_wait 0 S com.pptv.launcher u0_a28 4836 3182 1155132 115116 SyS_epoll_wait 0 S com.sohu.inputmethod.sogou.tv system 4886 3182 1109956 63532 SyS_epoll_wait 0 S com.bajintech.karaok u0_a12 4919 3182 1093604 48272 SyS_epoll_wait 0 S com.android.managedprovisioning u0_a7 4935 3182 1094580 55992 SyS_epoll_wait 0 S com.android.providers.calendar u0_a30 5006 3182 1409240 79520 SyS_epoll_wait 0 S com.hpplay.happyplay.aw u0_a30 5047 3182 1359780 49644 SyS_epoll_wait 0 S com.hpplay.happyplay.aw:remote u0_a13 5061 3182 1095028 46472 SyS_epoll_wait 0 S com.android.packageinstaller u0_a34 5094 3182 1130344 77368 SyS_epoll_wait 0 S com.dianshijia.newlive:channel u0_a23 5146 3182 1122584 79712 SyS_epoll_wait 0 S com.juli.dangbeimarket system 5435 3182 1415728 77000 SyS_epoll_wait 0 S com.pptv.launcher:ppbox system 5674 3182 1111520 65252 SyS_epoll_wait 0 S com.pptv.pushmsgsdk.SdkMainService system 5760 3182 1112772 63192 SyS_epoll_wait 0 S com.pptv.systemcleanservice u0_a2 6240 3182 1091704 50248 SyS_epoll_wait 0 S com.android.externalstorage u0_a10 6978 3182 1093292 54068 SyS_epoll_wait 0 S com.android.defcontainer system 7004 3182 1112768 62976 SyS_epoll_wait 0 S com.pptv.tvhousekeeper:provider root 7034 2 0 0 rescuer_thread 0 S [kbase_event] root 7054 2 0 0 rescuer_thread 0 S [kbase_event] root 7114 2 0 0 irq_thread 0 S [irq/34-ff600000] u0_i0 7192 3869 1092740 48996 SyS_epoll_wait 0 S com.android.webview:sandboxed_process0 root 7316 2 0 0 rescuer_thread 0 S [kbase_event] system 7607 3182 1149436 117128 SyS_epoll_wait 0 S com.pptv.tvhousekeeper root 7640 2 0 0 rescuer_thread 0 S [kbase_event] root 11423 2 0 0 rescuer_thread 0 S [kbase_event] root 12222 2 0 0 worker_thread 0 S [kworker/1:0] root 13427 2 0 0 worker_thread 0 S [kworker/2:2] root 13862 2 0 0 worker_thread 0 S [kworker/0:2] root 14747 2 0 0 worker_thread 0 S [kworker/0:0] root 15494 2 0 0 worker_thread 0 S [kworker/3:1] system 15499 3182 1473520 123204 SyS_epoll_wait 0 S com.pptv.screenprotect root 15648 2 0 0 rescuer_thread 0 S [kbase_event] root 15745 2 0 0 worker_thread 0 S [kworker/0:1] system 15792 3182 1098900 55612 SyS_epoll_wait 0 S com.pptv.snisupdate root 16228 3275 5964 3176 0 0 R ps system 17118 3182 1409440 131344 SyS_epoll_wait 0 S com.pplive.tvplayer root 17147 2 0 0 rescuer_thread 0 S [kbase_event] root 17305 2 0 0 worker_thread 0 S [kworker/u8:3] system 17512 3182 1159820 130196 SyS_epoll_wait 0 S com.pptv.setting root 18402 2 0 0 rescuer_thread 0 S [kbase_event] root 18454 2 0 0 rescuer_thread 0 S [kbase_event] system 18485 3182 1102328 61836 SyS_epoll_wait 0 S com.pptv.diagnostics root 19833 2 0 0 worker_thread 0 S [kworker/u9:1] root 20925 2 0 0 worker_thread 0 S [kworker/u9:0] root 22306 2 0 0 worker_thread 0 S [kworker/u8:0] root 23101 2 0 0 worker_thread 0 S [kworker/3:2] root 26412 2 0 0 worker_thread 0 S [kworker/1:1] root 32022 2 0 0 worker_thread 0 S [kworker/u9:3] root 32636 2 0 0 worker_thread 0 S [kworker/2:1]主要是从Android O(8)开始引入了HIDL, hal层的服务会以独立进程的形式存在,framework和hal层之间通过hw binder的方式进行同行。所以上图 android P(9)中多出了如下hal层的进程:
system 3187 1 6772 2888 binder_thread_read 0 S android.hidl.allocator@1.0-service audioserver 3188 1 49932 13972 binder_thread_read 0 S android.hardware.audio@2.0-service bluetooth 3189 1 11172 3080 binder_thread_read 0 S android.hardware.bluetooth@1.0-service cameraserver 3190 1 16540 3480 binder_thread_read 0 S android.hardware.camera.provider@2.4-service media 3191 1 9924 3112 binder_thread_read 0 S android.hardware.cas@1.0-service system 3193 1 9708 3100 binder_thread_read 0 S android.hardware.configstore@1.1-service media 3195 1 11068 3172 binder_thread_read 0 S android.hardware.drm@1.0-service media 3196 1 10916 2964 binder_thread_read 0 S android.hardware.drm@1.1-service.clearkey media 3197 1 13528 3112 binder_thread_read 0 S android.hardware.drm@1.1-service.widevine system 3198 1 8320 3064 binder_thread_read 0 S android.hardware.gatekeeper@1.0-service system 3199 1 15492 5588 binder_thread_read 0 S android.hardware.graphics.allocator@2.0-service system 3200 1 71048 6320 binder_thread_read 0 S android.hardware.graphics.composer@2.2-service system 3201 1 7636 3256 SyS_epoll_wait 0 S android.hardware.health@2.0-service system 3202 1 7500 3080 binder_thread_read 0 S android.hardware.light@2.0-service system 3203 1 7528 3220 binder_thread_read 0 S android.hardware.memtrack@1.0-service system 3204 1 7692 3184 binder_thread_read 0 S android.hardware.power@1.0-service system 3205 1 7540 3084 binder_thread_read 0 S android.hardware.thermal@1.0-service system 3206 1 7752 2944 binder_thread_read 0 S android.hardware.tv.cec@1.0-service system 3207 1 10744 3844 binder_thread_read 0 S android.hardware.tv.input@1.0-service system 3209 1 8464 2968 binder_thread_read 0 S android.hardware.usb@1.0-service wifi 3212 1 10396 3604 binder_thread_read 0 S android.hardware.wifi@1.0-service system 3093 1 8644 4024 binder_thread_read 0 S hwservicemanager system 3094 1 6424 2548 binder_thread_read 0 S vndservicemanager这些进程是在init 启动hal class类型的服务,调用各个rc文件中,比如说camera provider是在这里启动的。8.0以前的版本,hal层的功能是运行在cameraserver进程(framework中 camera service 所在的进程 )
hardware/hardware/interfaces/camera/provider/2.4/default ((7792daf...)) $ cat android.hardware.camera.provider\@2.4-service.rc service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service class hal user cameraserver group audio camera input drmrpc ioprio rt 4 capabilities SYS_NICE writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks值得注意的是,这里还多出了hwservicemanager 和 vndservicemanager。framework的服务管理是通过servicemanager,而Android O之后,设备节点多了/dev/hwbinder, /dev/vndbinder. 而hwservicemanager 用于hal层的服务管理,framework层的服务通过hwservicemanager 查询hal层的服务。而hal层的服务(vendor提供的)之间,通过 vndservicemanager来管理。
HIDL ,直通式HAL( Passthrough 模式)和 绑定式 HAL (Binderized模式)后续会补充上。