Revert "Updating test to include vendor security patch level"
This reverts commit ee7a193ea70c64c72c69796365f1c7dff52621ee.
Reason for revert: This belongs in VTS instead.
Bug: 110800742
Change-Id: I1b27e2456149995dc1f21f434002b43b1b0e6c30
Merged-In: I1b27e2456149995dc1f21f434002b43b1b0e6c30
diff --git a/tests/tests/os/src/android/os/cts/SecurityPatchTest.java b/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
index da72966..d6fb646 100644
--- a/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
+++ b/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
@@ -30,21 +30,17 @@
private static final String TAG = SecurityPatchTest.class.getSimpleName();
private static final String SECURITY_PATCH_ERROR =
- "security_patch should be in the format \"YYYY-MM-DD\". Found \"%s\"";
+ "ro.build.version.security_patch should be in the format \"YYYY-MM-DD\". Found \"%s\"";
private static final String SECURITY_PATCH_DATE_ERROR =
- "security_patch should be \"%d-%02d\" or later. Found \"%s\"";
+ "ro.build.version.security_patch should be \"%d-%02d\" or later. Found \"%s\"";
private static final int SECURITY_PATCH_YEAR = 2016;
private static final int SECURITY_PATCH_MONTH = 12;
private boolean mSkipTests = false;
- private String mVendorSecurityPatch;
- private String mBuildSecurityPatch;
@Override
protected void setUp() {
mSkipTests = (ApiLevelUtil.isBefore(Build.VERSION_CODES.M));
- mVendorSecurityPatch = SystemProperties.get("ro.vendor.build.security_patch", "");
- mBuildSecurityPatch = Build.VERSION.SECURITY_PATCH;
}
/** Security patch string must exist in M or higher **/
@@ -53,79 +49,54 @@
Log.w(TAG, "Skipping M+ Test.");
return;
}
- String error = String.format(SECURITY_PATCH_ERROR, mBuildSecurityPatch);
- assertTrue(error, !mBuildSecurityPatch.isEmpty());
- }
- public void testVendorSecurityPatchFound() {
- if (Build.VERSION.FIRST_SDK_INT <= Build.VERSION_CODES.O) {
- Log.w(TAG, "Skipping P+ Test");
- return;
- }
- assertTrue(!mVendorSecurityPatch.isEmpty());
- }
-
- public void testSecurityPatchesFormat() {
- if (mSkipTests) {
- Log.w(TAG, "Skipping M+ Test.");
- return;
- }
- String error = String.format(SECURITY_PATCH_ERROR, mBuildSecurityPatch);
- testSecurityPatchFormat(mBuildSecurityPatch, error);
-
- if (Build.VERSION.FIRST_SDK_INT <= Build.VERSION_CODES.O) {
- Log.w(TAG, "Skipping P+ Test");
- return;
- }
- error = String.format(SECURITY_PATCH_ERROR, mVendorSecurityPatch);
- testSecurityPatchFormat(mVendorSecurityPatch, error);
+ String buildSecurityPatch = Build.VERSION.SECURITY_PATCH;
+ String error = String.format(SECURITY_PATCH_ERROR, buildSecurityPatch);
+ assertTrue(error, !buildSecurityPatch.isEmpty());
}
/** Security patch should be of the form YYYY-MM-DD in M or higher */
- private void testSecurityPatchFormat(String patch, String error) {
- assertEquals(error, 10, patch.length());
- assertTrue(error, Character.isDigit(patch.charAt(0)));
- assertTrue(error, Character.isDigit(patch.charAt(1)));
- assertTrue(error, Character.isDigit(patch.charAt(2)));
- assertTrue(error, Character.isDigit(patch.charAt(3)));
- assertEquals(error, '-', patch.charAt(4));
- assertTrue(error, Character.isDigit(patch.charAt(5)));
- assertTrue(error, Character.isDigit(patch.charAt(6)));
- assertEquals(error, '-', patch.charAt(7));
- assertTrue(error, Character.isDigit(patch.charAt(8)));
- assertTrue(error, Character.isDigit(patch.charAt(9)));
- }
-
- public void testSecurityPatchDates() {
+ public void testSecurityPatchFormat() {
if (mSkipTests) {
Log.w(TAG, "Skipping M+ Test.");
return;
}
+ String buildSecurityPatch = Build.VERSION.SECURITY_PATCH;
+ String error = String.format(SECURITY_PATCH_ERROR, buildSecurityPatch);
+
+ assertEquals(error, 10, buildSecurityPatch.length());
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(0)));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(1)));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(2)));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(3)));
+ assertEquals(error, '-', buildSecurityPatch.charAt(4));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(5)));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(6)));
+ assertEquals(error, '-', buildSecurityPatch.charAt(7));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(8)));
+ assertTrue(error, Character.isDigit(buildSecurityPatch.charAt(9)));
+ }
+
+ /** Security patch should no older than the month this test was updated in M or higher **/
+ public void testSecurityPatchDate() {
+ if (mSkipTests) {
+ Log.w(TAG, "Skipping M+ Test.");
+ return;
+ }
+
+ String buildSecurityPatch = Build.VERSION.SECURITY_PATCH;
String error = String.format(SECURITY_PATCH_DATE_ERROR,
SECURITY_PATCH_YEAR,
SECURITY_PATCH_MONTH,
- mBuildSecurityPatch);
- testSecurityPatchDate(mBuildSecurityPatch, error);
+ buildSecurityPatch);
- if (Build.VERSION.FIRST_SDK_INT <= Build.VERSION_CODES.O) {
- Log.w(TAG, "Skipping P+ Test");
- return;
- }
- error = String.format(SECURITY_PATCH_DATE_ERROR,
- SECURITY_PATCH_YEAR,
- SECURITY_PATCH_MONTH,
- mVendorSecurityPatch);
- testSecurityPatchDate(mVendorSecurityPatch, error);
- }
- /** Security patch should no older than the month this test was updated in M or higher **/
- private void testSecurityPatchDate(String patch, String error) {
int declaredYear = 0;
int declaredMonth = 0;
try {
- declaredYear = Integer.parseInt(patch.substring(0,4));
- declaredMonth = Integer.parseInt(patch.substring(5,7));
+ declaredYear = Integer.parseInt(buildSecurityPatch.substring(0,4));
+ declaredMonth = Integer.parseInt(buildSecurityPatch.substring(5,7));
} catch (Exception e) {
assertTrue(error, false);
}