【問題描述】
工具:Cts-Verifier-9.0-R11.apk
測試Camera ITS Test時,點擊該測試項后verifier apk閃退。重新打開后該項未pass變綠。
【問題結論】
AuthBlog:秋城https://www.cnblogs.com/houser0323
最新結論:是waiver項。
拿到了Google-waiver id:https://partnerissuetracker.corp.google.com/issues/150153190
懷疑verifier工具問題
r8工具沒問題,r11有問題。
r11工具在送測成功的盒子也有問題。
【分析詳細】
1.crash日志:
03-04 14:34:36.977 8091 8091 D AndroidRuntime: Shutting down VM
--------- beginning of crash
03-04 14:34:36.987 8091 8091 E AndroidRuntime: FATAL EXCEPTION: main
03-04 14:34:36.987 8091 8091 E AndroidRuntime: Process: com.android.cts.verifier, PID: 8091
03-04 14:34:36.987 8091 8091 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.cts.verifier/com.android.cts.verifier.camera.its.ItsTestActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.cts.verifier.TestListAdapter.getCount()' on a null object reference
。。。。。。
03-04 14:34:36.987 8091 8091 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.cts.verifier.TestListAdapter.getCount()' on a null object reference
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at com.android.cts.verifier.PassFailButtons$TestListActivity.getHistoryCollection(PassFailButtons.java:294)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at com.android.cts.verifier.PassFailButtons$TestListActivity.setTestResultAndFinish(PassFailButtons.java:282)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at com.android.cts.verifier.camera.its.ItsTestActivity.onCreate(ItsTestActivity.java:347)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7144)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7135)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894)
03-04 14:34:36.987 8091 8091 E AndroidRuntime: ... 11 more
03-04 14:34:37.000 3184 4971 W ActivityManager: Force finishing activity com.android.cts.verifier/.camera.its.ItsTestActivity
03-04 14:34:37.003 3184 4971 W ActivityManager: Force finishing activity com.android.cts.verifier/.CtsVerifierActivity
03-04 14:34:37.009 2988 3123 W libc : Unable to set property "sys.vsync.type" to "": error code: 0x18
03-04 14:34:37.010 8091 8091 I Process : Sending signal. PID: 8091 SIG: 9
2.比較追溯源碼
經對比,r8不會crash。r8工具與r11工具的代碼有差異,新增了一個函數調用getHistoryCollection()
camera/its/ItsTestActivity.java +347
342 if (mToBeTestedCameraIds.size() == 0) {
343 showToast(R.string.all_exempted_devices);
344 ItsTestActivity.this.getReportLog().setSummary(
345 "PASS: all cameras on this device are exempted from ITS"
346 , 1.0, ResultType.NEUTRAL, ResultUnit.NONE);//該語句表明測試已經pass。crash出現在下一句,與測試邏輯無關,是apk自身代碼有問題。
347 setTestResultAndFinish(true);//
348 }
=============================================
ItsTestActivity.java:347
@@ -171,25 +160,19 @@
@Override
public void setTestResultAndFinish(boolean passed) {
PassFailButtons.setTestResultAndFinishHelper(
+ this, getTestId(), getTestDetails(), passed, getReportLog(),
+ getHistoryCollection());//增加了最后一個參數,是函數的調用返回值。
- this, getTestId(), getTestDetails(), passed, getReportLog());
}
=============================================
PassFailButtons.java:294
288 /**
289 * Get existing test history to aggregate.
290 */
291 @Override
292 public TestResultHistoryCollection getHistoryCollection() {
293 List<TestResultHistoryCollection> histories =
294 IntStream.range(0, mAdapter.getCount())//由於mAdapter是null,所以空指針異常crash了。
295 .mapToObj(mAdapter::getHistoryCollection)
296 .collect(Collectors.toList());
如上294,測試apk的代碼有問題,所以空指針異常crash了。