极力推荐Android 开发大总结文章:欢迎收藏
Android 开发技术文章大总结
本篇文章主要介绍 Android
开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:
1.解锁指纹,发送指纹中断Log
2.认证指纹,计算指纹耗时
3.指纹认证成功,keyguard 响应解锁屏流程
4.keyguard 解锁结束,开启动Launcher至绘制工作
5.Launcher 绘制完成,隐藏Keyguard
6.点亮屏幕结束,统计亮屏时间
1. 解锁指纹,发送指纹中断Log
从kernel log
中可以查看指纹发送的中断log
信息,信息如下:
Line 1747: 737[03-22 16:04:05.934] <4>[ 1206.056374] c0 174 <blestech_fp>[bf_eint_handler:785]++++irq_handler netlink send+++++,1,0
Line 1748: 738[03-22 16:04:05.934] <4>[ 1206.056392] c0 174 <blestech_fp>[bf_send_netlink_msg:665]enter, send command 102
Line 1749: 739[03-22 16:04:05.934] <4>[ 1206.056445] c0 174 <blestech_fp>[bf_send_netlink_msg:707]send done, data length is 32
Line 1750: 740[03-22 16:04:05.934] <4>[ 1206.056458] c0 174 <blestech_fp>[bf_eint_handler:794]-----irq_handler netlink -----
Line 1762: 752[03-22 16:04:05.935] <4>[ 1206.057683] c1 612 <blestech_fp>[bf_open:1023] Success to open device.
Line 1763: 753[03-22 16:04:05.935] <4>[ 1206.057718] c1 612 <blestech_fp>[bf_ioctl:843]BF_IOCTL_ENABLE_INTERRUPT: command,0
2. 认证指纹,计算指纹耗时
指纹解锁耗时计算
指纹解锁耗时:既从指纹中断(16:04:05.934
)到指纹认证成功(16:04:06.003
)。
既指纹耗时=1003-934 = 96ms
system log
中可以看到 指纹认证(onAuthenticated
),以及认证成功(onAuthenticationSucceeded
)
//指纹认证
00F359 03-22 16:04:06.002 715 715 V FingerprintService: onAuthenticated(owner=com.android.systemui, id=111, gp=0)
//指纹认证成功
00F35A 03-22 16:04:06.003 715 715 V FingerprintService: onAuthenticationSucceeded by keyguard,may need send launchapp msg
00F35C 03-22 16:04:06.007 715 715 V FingerprintService: Done with client: com.android.systemui
3. 指纹认证成功,keyguard 响应解锁屏流程
指纹 认证成功后,system log
中可以查看到以下信息,Keyguard
开始解锁流程,流程如下:
00F35C 03-22 16:04:06.007 715 715 V FingerprintService: Done with client: com.android.systemui
// SystemUI 唤醒CPU
00F363 03-22 16:04:06.022 715 4341 I PowerManagerService: Waking up from sleep due tocom.android.systemui android.policy:FINGERPRINT (uid=10040 reason=android.policy:FINGERPRINT)...
00F364 03-22 16:04:06.022 715 715 W UsageStatsService: Event reported without a package name
00F36D 03-22 16:04:06.032 715 740 I DisplayPowerController: Blocking screen on until initial contents have been drawn.
//开始准备打开屏幕,进行唤醒操作
00F36E 03-22 16:04:06.032 715 740 I WindowManager: Screen turning on...
00F370 03-22 16:04:06.044 715 715 I WindowManager: Started waking up...
00F370 03-22 16:04:06.044 715 715 I WindowManager: Started waking up...
00F381 03-22 16:04:06.046 715 4341 D PowerManagerService: userActivityNoUpdateLocked: Scene not defined, event:0
00F383 03-22 16:04:06.047 715 738 I DisplayManagerService: Display device changed state: "Built-in Screen", ON
//广播队列添加亮屏广播
00F386 03-22 16:04:06.048 715 715 D BroadcastQueue: Add broadcast <BroadcastRecord{9e27478 u-1 android.intent.action.SCREEN_ON}> into [ordered | foreground], pending size 0
在main log
中KeyguardViewMediator
这个调节器类开始进行亮屏时候是否显示锁屏界面等流程。
比如:notifyScreenOn
、keyguardDone()
、handleHide
、keyguardGoingAway
等
//keyguard 调节器通知screen on
00F372 03-22 16:04:06.045 1351 9065 D KeyguardViewMediator: notifyScreenOn
00F373 03-22 16:04:06.045 374 374 D PowerHAL: Enter power_set_interactive: 1
00F374 03-22 16:04:06.045 1351 9065 D KeyguardViewMediator: onStartedWakingUp, seq = 34
00F375 03-22 16:04:06.045 1351 9065 D KeyguardViewMediator: notifyStartedWakingUp
00F37D 03-22 16:04:06.046 374 374 D PowerHAL: ###Exit screen_off scene end###
00F37E 03-22 16:04:06.046 374 374 D PowerHAL: Exit power_set_interactive: 1
//keyguard 调节器执行完成
00F37F 03-22 16:04:06.046 1351 1351 D KeyguardViewMediator: keyguardDone()
00F3AE 03-22 16:04:06.057 1351 1351 D KeyguardViewMediator: handleNotifyScreenTurningOn
00F3BC 03-22 16:04:06.061 1351 1351 D KeyguardViewMediator: handleNotifyWakingUp
00F3BF 03-22 16:04:06.061 1351 1351 D KeyguardUpdateMonitor: FaceLock handleStartedWakingUp
00F458 03-22 16:04:06.077 1351 1351 V KeyguardUpdateMonitor: stopListeningForFaceLock()
//keyguard 结束并因此,开始进入Launcher
00F459 03-22 16:04:06.077 1351 1351 D KeyguardViewMediator: handleKeyguardDone
00F45A 03-22 16:04:06.077 1351 1351 D KeyguardViewMediator: handleHide
//keyguardGoingAway 等待下一个界面绘制完成
00F45B 03-22 16:04:06.077 1351 1351 D KeyguardViewMediator: keyguardGoingAway
4.keyguard 解锁结束,开启动Launcher至绘制工作
event log
中可以看到keyguard 解锁结束后开始启动Launcher
。
//开启启动Launcher
00F466 03-22 16:04:06.079 715 2015 I am_set_resumed_activity: [0,com.android.launcher3/com.android.searchlauncher.SearchLauncher,resumeTopActivityInnerLocked]
00F48F 03-22 16:04:06.085 715 2015 I am_resume_activity: [0,77745185,3,com.android.launcher3/com.android.searchlauncher.SearchLauncher]
在main log
中可以看到Launcher
绘制完成。
//SurfaceFlinger 完成Launcher 绘制
00F54A 03-22 16:04:06.534 1351 1351 D KeyguardUpdateMonitor: handleBatteryUpdate
00F54D 03-22 16:04:06.535 380 380 D SurfaceFlinger: duplicate layer name: changing com.android.launcher3/com.android.searchlauncher.SearchLauncher to com.android.launcher3/com.android.searchlauncher.SearchLauncher#1
Launcher 绘制耗时计算
Launcher
绘制耗时计算=绘制完成(16:04:06.535
)- 开始启动(16:04:06.079
)=458ms(535ms-79ms)
5.Launcher 绘制完成,隐藏Keyguard
在system log
中可以看到Launcher
绘制完成后,keyguard
收到回调,隐藏keygaurd
。
//keyguard收到回调,隐藏keygaurd
00F577 03-22 16:04:06.588 1351 1351 D KeyguardViewMediator: handleStartKeyguardExitAnimation startTime=1206710 fadeoutDuration=0
00F578 03-22 16:04:06.588 1351 1351 D KeyguardViewMediator: isSimPinOrPuk =false
00F579 03-22 16:04:06.588 715 6388 D WindowManager: mKeyguardDelegate.ShowListener.onDrawn.
// KeyguardDrawComplete 结束后并隐藏
00F57A 03-22 16:04:06.589 715 730 W WindowManager: Setting mKeyguardDrawComplete
00F592 03-22 16:04:06.604 1351 1351 V KeyguardDisplayManager: hide
//窗口焦点在 Launcher上
00F5BE 03-22 16:04:06.621 715 1590 D WindowManager: Input focus has changed to Window{3393c4a u0 com.android.launcher3/com.android.searchlauncher.SearchLauncher}
0
6.电量屏幕结束,统计亮屏时间
system log
中搜索关键字 Screen on took, 即可查看总亮屏耗时。
总亮屏耗时
总亮屏耗时(798ms
)= 亮屏结束Finished waking up
(16:04:06.820
)- 屏幕开始打开Screen turning on...
(03-22 16:04:06.032
)
// 绘制结束,显示所有窗口
00F68B 03-22 16:04:06.816 715 738 I WindowManager: All windows ready for display!
00F68C 03-22 16:04:06.817 715 730 W WindowManager: Setting mWindowManagerDrawComplete
00F692 03-22 16:04:06.819 715 730 D WindowManager: finishScreenTurningOn: mAwake=true, mScreenOnEarly=true, mScreenOnFully=false, mKeyguardDrawComplete=true, mWindowManagerDrawComplete=true
//结束亮屏流程,统计 亮屏时间
00F693 03-22 16:04:06.819 715 730 I WindowManager: Finished screen turning on...
00F695 03-22 16:04:06.819 715 740 I DisplayPowerController: Unblocked screen on after 787 ms
00F69A 03-22 16:04:06.820 715 740 W PowerManagerService: Screen on took 798 ms(now:1206942 mLastWakeTime:1206144)
//结束wake up 流程
00F69B 03-22 16:04:06.821 715 715 I WindowManager: Finished waking up...
至此,本篇已结束,如有不对的地方,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!
原文地址:https://www.cnblogs.com/wangjie1990/p/11327111.html