1.问题描述
CtsDevicePolicyManagerTestCases--com.android.cts.devicepolicy.QuietModeHostsideTest#testBroadcastManagedProfileAvailable_withoutCrossProfileAppsOp FAIL
2.测试命令
run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.QuietModeHostsideTest#testBroadcastManagedProfileAvailable_withoutCrossProfileAppsOp
3.同类问题分析过程:
1.host_log_xxx.txt中搜索关键“ModuleListener”或“fail:”,定向log的报错位置;
12-22 17:41:54 I/ConsoleReporter: [1/1 armeabi-v7a CtsDevicePolicyManagerTestCases 8T99621AA19A0200170] com.android.cts.devicepolicy.QuietModeHostsideTest#testBroadcastManagedProfileAvailable_withoutCrossProfileAppsOp fail: expected to contain:
CrossProfileEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)
but was:
--------- beginning of system
12-22 17:38:53.416 1054 2956 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=com.google.android.gms.gcm.ACTION_SCHEDULE pkg=com.google.android.gms (has extras) }
12-22 17:38:53.442 1054 3465 D PowerManagerService: updateWakeLockSummaryLocked: mWakefulness=Awake, mWakeLockSummary=0x1
......
12-22 17:39:20.335 6706 7584 I DynamiteModule: Considering local module com.google.android.gms.providerinstaller.dynamite:1 and remote module com.google.android.gms.providerinstaller.dynamite:0
12-22 17:39:20.335 6706 7584 I DynamiteModule: Selected local version of com.google.android.gms.providerinstaller.dynamite
at com.android.cts.devicepolicy.QuietModeHostsideTest.verifyBroadcastSent(QuietModeHostsideTest.java:186)
at com.android.cts.devicepolicy.QuietModeHostsideTest.checkBroadcastManagedProfileAvailable(QuietModeHostsideTest.java:169)
at com.android.cts.devicepolicy.QuietModeHostsideTest.testBroadcastManagedProfileAvailable_withoutCrossProfileAppsOp(QuietModeHostsideTest.java:131)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
确认问题初步原因;此时日志中来看是由于跑测工具抓取的日志未包含预期日志,这里的预期日志为“CrossProfileEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)”,那么double check下是否该段日志真的未正常打印,那么进一步分析logcat;
2.device_logcat_test_xxx.txt中搜索“CrossProfileEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)”,发现包含相关日志,如下:
Line 50822: 12-22 17:38:00.648 1054 2954 I DevicePolicyManager: Sending android.intent.action.MANAGED_PROFILE_AVAILABLE broadcast to manifest receivers.
Line 50869: 12-22 17:38:00.659 1054 2954 I DevicePolicyManager: Sending android.intent.action.MANAGED_PROFILE_AVAILABLE broadcast to com.google.android.apps.wellbeing.
Line 50870: 12-22 17:38:00.659 1054 2954 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=android.intent.action.MANAGED_PROFILE_AVAILABLE flg=0x1000000 cmp=com.google.android.apps.wellbeing/.workscheduler.manager.ManagedProfileChangesListener_Receiver (has extras) }
Line 50872: 12-22 17:38:00.661 1054 2954 I DevicePolicyManager: Sending android.intent.action.MANAGED_PROFILE_AVAILABLE broadcast to com.android.cts.crossprofileenabledapp.
Line 50874: 12-22 17:38:00.661 1054 2954 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=android.intent.action.MANAGED_PROFILE_AVAILABLE flg=0x1000000 cmp=com.android.cts.crossprofileenabledapp/.CrossProfileEnabledAppReceiver (has extras) }
Line 50879: 12-22 17:38:00.663 1054 2954 I DevicePolicyManager: Sending android.intent.action.MANAGED_PROFILE_AVAILABLE broadcast to com.android.cts.crossprofileuserenabledapp.
Line 50880: 12-22 17:38:00.663 1054 2954 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=android.intent.action.MANAGED_PROFILE_AVAILABLE flg=0x1000000 cmp=com.android.cts.crossprofileuserenabledapp/.CrossProfileUserEnabledAppReceiver (has extras) }
Line 50881: 12-22 17:38:00.665 1054 2954 I DevicePolicyManager: Sending android.intent.action.MANAGED_PROFILE_AVAILABLE broadcast to com.android.cts.modifyquietmodeenabledapp.
Line 50882: 12-22 17:38:00.665 1054 2954 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=android.intent.action.MANAGED_PROFILE_AVAILABLE flg=0x1000000 cmp=com.android.cts.modifyquietmodeenabledapp/.ModifyQuietModeEnabledAppReceiver (has extras) }
Line 50883: 12-22 17:38:00.665 1054 2954 W ActivityManager: [HMDenterprise broadcastIntentLocked] intent=Intent { act=android.intent.action.MANAGED_PROFILE_AVAILABLE flg=0x40000000 (has extras) }
Line 51917: 12-22 17:38:04.750 6264 6264 W CrossProfileEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)
Line 51920: 12-22 17:38:04.757 6285 6285 W CrossProfileUserEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)
Line 51926: 12-22 17:38:04.772 6306 6306 W ModifyQuietModeEnabledAppReceiver: onReceive(android.intent.action.MANAGED_PROFILE_AVAILABLE)
那么分析下来,mainlog中有该信息,但是在工具跑测抓取的日志片段中未包含;而且跑测工具抓取到的日志比较滞后,确认为工具抓取的日志时长比较短,或者滞后,或者buffer比较小,在跑测抓取的日志比较少的情况下未能包含仅跑测工具的日志片段中,那么此时手动enlarge buffer大小,跑测pass。
总结:cts工具跑测过程中搜集的日志不能满足跑测要求,在google不能更新工具的情况下,可以手动调整buffer以规避。