GTS7.0-R3 GtsSettingsTestCases com.google.android.settings.gts.MADAComplianceTest#testMADACompliance

armeabi-v7a GtsSettingsTestCases
Test Result Details
com.google.android.settings.gts.MADAComplianceTest#testMADACompliance

fail

java.lang.RuntimeException: Android 5.0 and newer GMS Devices MUST expose the Android security patch level in the Settings UI. It MUST be displayed below the Android version item in the 'About …' section. The displayed text MUST match the value of the system property ro.build.version.security_patch, which MUST be in the format 'YYYY-MM-DD' according to the CDD section 3.2.2. Build Parameters.Please see the following for details: https://support.google.com/androidpartners_gms/answer/7351400?hl=en&ref_topic=9252245

arm64-v8a GtsSettingsTestCases
Test Result Details
com.google.android.settings.gts.MADAComplianceTest#testMADACompliance

fail

java.lang.RuntimeException: Android 5.0 and newer GMS Devices MUST expose the Android security patch level in the Settings UI. It MUST be displayed below the Android version item in the 'About …' section. The displayed text MUST match the value of the system property ro.build.version.security_patch, which MUST be in the format 'YYYY-MM-DD' according to the CDD section 3.2.2. Build Parameters.Please see the following for details: https://support.google.com/androidpartners_gms/answer/7351400?hl=en&ref_topic=9252245

 12-25 17:11:21 I/ModuleListener: [1/1] com.google.android.settings.gts.MADAComplianceTest#testMADACompliance fail:
java.lang.RuntimeException: Android 5.0 and newer GMS Devices MUST expose the Android security patch level in the Settings UI. It MUST be displayed below the Android version item in the 'About …' section. The displayed text MUST match the value of the system property ro.build.version.security_patch, which MUST be in the format 'YYYY-MM-DD' according to the CDD section 3.2.2. Build Parameters.Please see the following for details: https://support.google.com/androidpartners_gms/answer/7351400?hl=en&ref_topic=9252245
    at org.junit.Assert.fail(Assert.java:88)
    at com.android.compatibility.common.util.BusinessLogicTestCase.failTest(BusinessLogicTestCase.java:123)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.compatibility.common.util.BusinessLogicExecutor$ResolvedMethod.invoke(BusinessLogicExecutor.java:220)
    at com.android.compatibility.common.util.BusinessLogicExecutor.invokeMethod(BusinessLogicExecutor.java:145)
    at com.android.compatibility.common.util.BusinessLogicExecutor.executeAction(BusinessLogicExecutor.java:72)

从报错看security patch必须要显示成'YYYY-MM-DD'的格式

在GTS工具中的testcase文件夹中找到GtsSettingsTestCases.apks(测试的代码一般是以模块命名的apk或jar包),GTS反编译后的测试代码如下:

 public boolean checkSecurityPatchDisplay(String[] spKeywords) throws UiObjectNotFoundException, InterruptedException, IOException, RemoteException {

        boolean bOK = true;

        UiDevice device = UiDevice.getInstance(BusinessLogicTestCase.getInstrumentation());

        setup();

        PackageManager pm = this.mContext.getPackageManager();

        if (Build.VERSION.SDK_INT < 21 || pm.hasSystemFeature(FeatureUtil.WATCH_FEATURE)) {

            return true;

        }

        execute("am start --activity-clear-task -a android.settings.DEVICE_INFO_SETTINGS");

        device.waitForIdle();

        if (!checkSecurityPatchCore(spKeywords)) {

            if (settingExists("About phone", true)) {        //检查是否有About phone 菜单

                return checkSecurityPatchCore(spKeywords);   // 如果有About phone,就在里面检查Android security patch level 菜单

            }

            bOK = false;

        }

        return bOK;

    }

 

从测试现象看,About phone里面有两个Android security patch level 菜单,所以测试的时候不知道选哪一个,卡着不会往下走,导致fail

GTS7.0-R3 GtsSettingsTestCases com.google.android.settings.gts.MADAComplianceTest#testMADACompliance

解决方案:

将其中一个Android security patch level 菜单从About phone中移到别的地方,或者去掉。