From d0bf9ecbea1b1085cfba0645384ae906e051bc77 Mon Sep 17 00:00:00 2001 From: Varun Praveen Goyal Date: Tue, 25 Apr 2023 10:03:50 +0000 Subject: CTS test for Android Security b/179042963 Bug: 179042963 Bug: 188664030 Test: Ran the new testcase on android-11.0.0_r2 with/without patch Change-Id: I9c9916337034225278747e2d1fc565fbc77c7ebd Merged-In: I9c9916337034225278747e2d1fc565fbc77c7ebd --- tests/tests/security/AndroidManifest.xml | 13 ++ tests/tests/security/res/values/strings.xml | 15 +++ .../res/xml/device_admin_cve_2021_0600.xml | 20 +++ .../security/cts/CVE_2021_0600/CVE_2021_0600.java | 137 +++++++++++++++++++++ .../security/cts/CVE_2021_0600/PocActivity.java | 86 +++++++++++++ .../cts/CVE_2021_0600/PocDeviceAdminReceiver.java | 22 ++++ 6 files changed, 293 insertions(+) create mode 100644 tests/tests/security/res/xml/device_admin_cve_2021_0600.xml create mode 100644 tests/tests/security/src/android/security/cts/CVE_2021_0600/CVE_2021_0600.java create mode 100644 tests/tests/security/src/android/security/cts/CVE_2021_0600/PocActivity.java create mode 100644 tests/tests/security/src/android/security/cts/CVE_2021_0600/PocDeviceAdminReceiver.java diff --git a/tests/tests/security/AndroidManifest.xml b/tests/tests/security/AndroidManifest.xml index 9c43b58b317..2d4a8107b3f 100644 --- a/tests/tests/security/AndroidManifest.xml +++ b/tests/tests/security/AndroidManifest.xml @@ -226,6 +226,19 @@ + + + + + + + + + https://google.com@evil.com @evil.com https + + + CVE_2021_0600_action + Failed to create a charsequence to contain HTML + text + Vulnerable to b/179042963 !! + Failed to resolve %1$s + exception + html + noException + .*CVE_2021_0600_EXPN.* + UI element with text pattern %1$s not found + + CVE_2021_0600_EXPN + CVE_2021_0600_EXPN]]> diff --git a/tests/tests/security/res/xml/device_admin_cve_2021_0600.xml b/tests/tests/security/res/xml/device_admin_cve_2021_0600.xml new file mode 100644 index 00000000000..2b7410c06d4 --- /dev/null +++ b/tests/tests/security/res/xml/device_admin_cve_2021_0600.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0600/CVE_2021_0600.java b/tests/tests/security/src/android/security/cts/CVE_2021_0600/CVE_2021_0600.java new file mode 100644 index 00000000000..7981c4253bf --- /dev/null +++ b/tests/tests/security/src/android/security/cts/CVE_2021_0600/CVE_2021_0600.java @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2021_0600; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assume.assumeNoException; +import static org.junit.Assume.assumeTrue; + +import android.app.Instrumentation; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.graphics.Rect; +import android.platform.test.annotations.AsbSecurityTest; +import android.security.cts.R; +import android.support.test.uiautomator.By; +import android.support.test.uiautomator.BySelector; +import android.support.test.uiautomator.UiDevice; +import android.support.test.uiautomator.UiObject2; +import android.support.test.uiautomator.Until; + +import androidx.test.runner.AndroidJUnit4; + +import com.android.sts.common.util.StsExtraBusinessLogicTestCase; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; + +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class CVE_2021_0600 extends StsExtraBusinessLogicTestCase { + private static final long TIMEOUT_MS = 5000; + private CompletableFuture mPocActivityReturn; + private UiDevice mDevice; + private Context mContext; + + // b/179042963 + // Vulnerable package : com.android.settings (As per AOSP code) + // Vulnerable app : Settings.apk (As per AOSP code) + @AsbSecurityTest(cveBugId = 179042963) + @Test + public void testPocCVE_2021_0600() { + try { + Instrumentation instrumentation = getInstrumentation(); + mDevice = UiDevice.getInstance(instrumentation); + mContext = instrumentation.getContext(); + + // Registering a broadcast receiver to receive broadcast from PocActivity. + mPocActivityReturn = new CompletableFuture<>(); + BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + try { + mPocActivityReturn.complete(intent.getStringExtra( + mContext.getString(R.string.cve_2021_0600_keyException))); + } catch (Exception e) { + // ignore. + } + } + }; + mContext.registerReceiver(broadcastReceiver, + new IntentFilter(mContext.getString(R.string.cve_2021_0600_action))); + + // Launch the PocActivity which in turn starts DeviceAdminAdd activity with normal + // text as 'explanation'. + Intent intent = new Intent(mContext, PocActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + intent.putExtra(mContext.getString(R.string.cve_2021_0600_keyHtml), false); + mContext.startActivity(intent); + String pocActivityException = mPocActivityReturn.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); + assumeTrue(pocActivityException, pocActivityException.trim() + .equals(mContext.getString(R.string.cve_2021_0600_noException))); + + // Get the height of the normal text with no formatting. Because width is same both + // with and without fix, height is being used for comparing the with and without + // fix behaviour. + int heightWoHtml = getVulnerableUIHeight(); + assumeTrue(heightWoHtml != -1); + + // Launch PocActivity again such that DeviceAdminAdd activity starts with formatted text + // this time. + mPocActivityReturn = new CompletableFuture<>(); + intent.putExtra(mContext.getString(R.string.cve_2021_0600_keyHtml), true); + mContext.startActivity(intent); + pocActivityException = mPocActivityReturn.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); + assumeTrue(pocActivityException, pocActivityException + .equalsIgnoreCase(mContext.getString(R.string.cve_2021_0600_noException))); + + // Get the height of HTML text with formatting. + int heightWithHtml = getVulnerableUIHeight(); + assumeTrue(heightWithHtml != -1); + + // On vulnerable device, the text displayed on the screen will be HTML formatted, so + // there will be considerable increase in height of the text due to

tag, if there + // is at least 20% increase in height, the test will fail. + assertFalse(mContext.getString(R.string.cve_2021_0600_failMsg), + heightWithHtml > 1.2 * heightWoHtml); + } catch (Exception e) { + assumeNoException(e); + } + } + + private int getVulnerableUIHeight() { + Pattern pattern = Pattern.compile(mContext.getString(R.string.cve_2021_0600_pattern), + Pattern.CASE_INSENSITIVE); + BySelector selector = By.text(pattern); + assumeTrue(mContext.getString(R.string.cve_2021_0600_patternNotFound, pattern), + mDevice.wait(Until.hasObject(selector), TIMEOUT_MS)); + UiObject2 obj = mDevice.findObject(selector); + if (obj != null && obj.getText() != null + && obj.getText().contains(mContext.getString(R.string.cve_2021_0600_targetText))) { + Rect bounds = obj.getVisibleBounds(); + return bounds.bottom - bounds.top; + } + return -1; + } +} diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocActivity.java b/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocActivity.java new file mode 100644 index 00000000000..2634a426941 --- /dev/null +++ b/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocActivity.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2021_0600; + +import static org.junit.Assume.assumeFalse; +import static org.junit.Assume.assumeNotNull; + +import android.app.Activity; +import android.app.admin.DevicePolicyManager; +import android.content.ComponentName; +import android.content.Intent; +import android.os.Bundle; +import android.security.cts.R; +import android.text.Html; + +// The vulnerable activity ADD_DEVICE_ADMIN can't be started as a new task hence PocActivity is +// created to launch it. +public class PocActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + try { + super.onCreate(savedInstanceState); + + // Create an intent to launch DeviceAdminAdd activity. + Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); + assumeNotNull(getString(R.string.cve_2021_0600_intentNotFound, intent), + intent.resolveActivity(getPackageManager())); + intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, + new ComponentName(this, PocDeviceAdminReceiver.class)); + + // For adding an extra 'explanation' to the intent, creating a charsequence object. + CharSequence seq = Html.fromHtml(getString(R.string.cve_2021_0600_targetText)); + if (getIntent().getBooleanExtra(getString(R.string.cve_2021_0600_keyHtml), false)) { + seq = Html.fromHtml(getString(R.string.cve_2021_0600_targetTextHtml)); + } + + // Using Html.fromHtml() causes whitespaces to occur at the start/end of the text which + // are unwanted. Remove the whitespace characters if any at the start and end of the + // charsequence. + int end = seq.length() - 1; + int start = 0; + while ((Character.isWhitespace(seq.charAt(start))) && start < end) { + ++start; + } + while ((Character.isWhitespace(seq.charAt(end))) && end > start) { + --end; + } + + // Check if the charsequence is valid after trimming the whitespaces. + assumeFalse(getString(R.string.cve_2021_0600_errorCreateCharSeq), start > end); + + // Adding the extra 'explanation' and launching the activity. + intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, + seq.subSequence(start, end + 1)); + startActivity(intent); + + // Send a broadcast to indicate no exceptions occurred. + sendBroadcast(new Intent(getString(R.string.cve_2021_0600_action)).putExtra( + getString(R.string.cve_2021_0600_keyException), + getString(R.string.cve_2021_0600_noException))); + } catch (Exception e) { + try { + // Send a broadcast to report exception. + sendBroadcast(new Intent(getString(R.string.cve_2021_0600_action)) + .putExtra(getString(R.string.cve_2021_0600_keyException), e.getMessage())); + } catch (Exception ignored) { + // ignore. + } + } + } +} diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocDeviceAdminReceiver.java b/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocDeviceAdminReceiver.java new file mode 100644 index 00000000000..4d429cf48f8 --- /dev/null +++ b/tests/tests/security/src/android/security/cts/CVE_2021_0600/PocDeviceAdminReceiver.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security.cts.CVE_2021_0600; + +import android.app.admin.DeviceAdminReceiver; + +public class PocDeviceAdminReceiver extends DeviceAdminReceiver { +} -- cgit v1.2.3 From e73fea1b381e339a3d4159529a037b3cb987565a Mon Sep 17 00:00:00 2001 From: Sergey Nikolaienkov Date: Thu, 7 Sep 2023 16:05:07 +0200 Subject: DO NOT MERGE Check form factors in DownloadManagerTest Do not run DownloadManagerTest#testDownload_onMediaStore on Android Auto OS, TV (Leanback) and Wear OS devices. Bug: 296924188 Test: run cts -m CtsAppTestCases -t android.app.cts.DownloadManagerTest#testDownload_onMediaStore DownloadsDeleted Merged-In: I61974e9d5aa3a864836dcc01c3ee311a14449805 Change-Id: I61974e9d5aa3a864836dcc01c3ee311a14449805 --- .../app/src/android/app/cts/DownloadManagerTest.java | 2 +- .../src/android/app/cts/DownloadManagerTestBase.java | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/app/src/android/app/cts/DownloadManagerTest.java b/tests/app/src/android/app/cts/DownloadManagerTest.java index 21206871850..901b7adb7aa 100644 --- a/tests/app/src/android/app/cts/DownloadManagerTest.java +++ b/tests/app/src/android/app/cts/DownloadManagerTest.java @@ -698,7 +698,7 @@ public class DownloadManagerTest extends DownloadManagerTestBase { @Test public void testDownload_onMediaStoreDownloadsDeleted() throws Exception { - assumeFalse(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)); + assumeDocumentsUiAvailableOnFormFactor(); // prepare file File file = new File(Environment.getExternalStoragePublicDirectory( diff --git a/tests/app/src/android/app/cts/DownloadManagerTestBase.java b/tests/app/src/android/app/cts/DownloadManagerTestBase.java index 30705f0053c..69d71c5a710 100644 --- a/tests/app/src/android/app/cts/DownloadManagerTestBase.java +++ b/tests/app/src/android/app/cts/DownloadManagerTestBase.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeFalse; import android.app.DownloadManager; import android.app.Instrumentation; @@ -467,6 +468,25 @@ public class DownloadManagerTestBase { || pm.hasSystemFeature(PackageManager.FEATURE_ETHERNET); } + /** + * Some non-mobile form factors ship a "stub" DocumentsUI package. Such stub packages may + * effectively declare "no-op" components similar to those in the "real" DocUI. + * For example, WearOS devices ship FrameworkPackageStubs that declares an Activity that should + * handle {@link Intent#ACTION_OPEN_DOCUMENT}, that when started will simply return + * {@link android.app.Activity#RESULT_CANCELED} right away. + *

+ * This method "runs" a few {@link org.junit.Assume assumptions} to make sure we are not running + * on one of the form factors that ship with such stub packages. + *

+ * For now, these form factors are: Auto (Android Automotive OS), TVs and wearables (Wear OS). + */ + protected void assumeDocumentsUiAvailableOnFormFactor() { + final PackageManager pm = mContext.getPackageManager(); + assumeFalse(pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)); + assumeFalse(pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)); // TVs + assumeFalse(pm.hasSystemFeature(PackageManager.FEATURE_WATCH)); + } + public static class DownloadCompleteReceiver extends BroadcastReceiver { private HashSet mCompleteIds = new HashSet<>(); -- cgit v1.2.3 From 82f6e5b3ffa4c6621b2f98fc65dd6392b2a248cc Mon Sep 17 00:00:00 2001 From: Sally Date: Wed, 22 Nov 2023 00:32:47 +0000 Subject: [Exo] Correct the area for gesture detection Test testTriggerTouchExploration_topFocusDisplayIsLastNonProxyDisplay would always return false when making an assumption check on the width of the display and would never actually run. The virtual display size was not the real phone display size, which the original min width value was based on (taken from TouchExplorerTest). Since all we're doing is testing taps, which don't require a big area, we'll just use half of the virtual display size. Bug: 286917088 Test: AccessibilityDisplayProxyTest Merged-In: I57a2c6a329a2f9304df91baa2eaac83a0363b7b6 Change-Id: I57a2c6a329a2f9304df91baa2eaac83a0363b7b6 --- .../cts/AccessibilityDisplayProxyTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDisplayProxyTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDisplayProxyTest.java index 60c00220bec..4306fdc3494 100644 --- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDisplayProxyTest.java +++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDisplayProxyTest.java @@ -105,7 +105,6 @@ import android.platform.test.annotations.Presubmit; import android.provider.Settings; import android.util.DisplayMetrics; import android.util.SparseArray; -import android.util.TypedValue; import android.view.Display; import android.view.InputDevice; import android.view.KeyEvent; @@ -204,8 +203,10 @@ public class AccessibilityDisplayProxyTest { private static final String SEPARATE_PROCESS_PACKAGE_NAME = "foo.bar.proxy"; private static final String SEPARATE_PROCESS_ACTIVITY = ".NonProxySeparateAppActivity"; - - private static final float MIN_SCREEN_WIDTH_MM = 40.0f; + public static final int VIRTUAL_DISPLAY_WIDTH = 100; + // Minimum screen width for supporting taps. This is more arbitrary since clicking or + // tapping requires a single point. We use half the virtual display width. + private static final int MIN_SCREEN_WIDTH_TAP_PX = VIRTUAL_DISPLAY_WIDTH / 2; private static final int TEST_SYSTEM_ACTION_ID = 1000; public static final String INSTRUMENTED_STREAM_ROLE_PACKAGE_NAME = "android.accessibilityservice.cts"; @@ -583,8 +584,7 @@ public class AccessibilityDisplayProxyTest { WindowManager.class); final DisplayMetrics metrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getRealMetrics(metrics); - assumeTrue(areaOfActivityWindowOnDisplay.width() > TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_MM, MIN_SCREEN_WIDTH_MM, metrics)); + assumeTrue(areaOfActivityWindowOnDisplay.width() > MIN_SCREEN_WIDTH_TAP_PX); sUiAutomation.executeAndWaitForEvent(() -> { final int xOnScreen = areaOfActivityWindowOnDisplay.centerX(); @@ -1508,7 +1508,8 @@ public class AccessibilityDisplayProxyTest { mFakeAssociationRule.getAssociationInfo().getId(), DEFAULT_VIRTUAL_DEVICE_PARAMS); // Values taken from StreamedAppClipboardTest - mImageReader = ImageReader.newInstance(/* width= */ 100, /* height= */ 100, + mImageReader = ImageReader.newInstance(/* width= */ VIRTUAL_DISPLAY_WIDTH, + /* height= */ 100, PixelFormat.RGBA_8888, /* maxImages= */ 1); display = mVirtualDevice.createVirtualDisplay( /* width= */ mImageReader.getWidth(), -- cgit v1.2.3 From d53f11f06dc3dd6bfa2acbb6f47ea09d71d09647 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 29 Nov 2023 02:14:26 +0000 Subject: Fix incorrect permissions for HANDS_ON_DETECTION_ENABLED Bug: 313728794 Test: atest CtsCarTestCases:CarPropertyManagerTest Change-Id: I1de040a113845f764db65bd04d9daa3aacdbeb00 --- tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java index d3db6dcdf43..593df28f047 100644 --- a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java +++ b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java @@ -1498,8 +1498,8 @@ public final class CarPropertyManagerTest extends AbstractCarTestCase { Integer.class, mCarPropertyManager) .setAllPossibleEnumValues(possibleEnumValues) .setDependentOnProperty(VehiclePropertyIds.HANDS_ON_DETECTION_ENABLED, - ImmutableSet.of(Car.PERMISSION_READ_ADAS_SETTINGS, - Car.PERMISSION_CONTROL_ADAS_SETTINGS)) + ImmutableSet.of(Car.PERMISSION_READ_DRIVER_MONITORING_SETTINGS, + Car.PERMISSION_CONTROL_DRIVER_MONITORING_SETTINGS)) .verifyErrorStates() .addReadPermission(Car.PERMISSION_READ_DRIVER_MONITORING_STATES) .build(); @@ -1529,8 +1529,8 @@ public final class CarPropertyManagerTest extends AbstractCarTestCase { Integer.class, mCarPropertyManager) .setAllPossibleEnumValues(possibleEnumValues) .setDependentOnProperty(VehiclePropertyIds.HANDS_ON_DETECTION_ENABLED, - ImmutableSet.of(Car.PERMISSION_READ_ADAS_SETTINGS, - Car.PERMISSION_CONTROL_ADAS_SETTINGS)) + ImmutableSet.of(Car.PERMISSION_READ_DRIVER_MONITORING_SETTINGS, + Car.PERMISSION_CONTROL_DRIVER_MONITORING_SETTINGS)) .verifyErrorStates() .addReadPermission(Car.PERMISSION_READ_DRIVER_MONITORING_STATES) .build(); -- cgit v1.2.3 From 91f8e3ce940a5cdc483ef7ec1e0ef64d51a3d4ab Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 29 Nov 2023 02:29:46 +0000 Subject: Re-add missing info model year test Bug: 307820217 Test: atest CtsCarTestCases:CarPropertyManagerTest Change-Id: I8bc88c8ffcf3fcd665642784b9a492e876826551 --- .../src/android/car/cts/CarPropertyManagerTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java index d3db6dcdf43..420abf1f365 100644 --- a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java +++ b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java @@ -1090,6 +1090,7 @@ public final class CarPropertyManagerTest extends AbstractCarTestCase { getInfoVinVerifier(), getInfoMakeVerifier(), getInfoModelVerifier(), + getInfoModelYearVerifier(), getInfoFuelCapacityVerifier(), getInfoFuelTypeVerifier(), getInfoEvBatteryCapacityVerifier(), @@ -1708,10 +1709,26 @@ public final class CarPropertyManagerTest extends AbstractCarTestCase { } @Test - public void testInfoModelYearIfSupported() { + public void testInfoModelIfSupported() { getInfoModelVerifier().verify(); } + private VehiclePropertyVerifier getInfoModelYearVerifier() { + return VehiclePropertyVerifier.newBuilder( + VehiclePropertyIds.INFO_MODEL_YEAR, + CarPropertyConfig.VEHICLE_PROPERTY_ACCESS_READ, + VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL, + CarPropertyConfig.VEHICLE_PROPERTY_CHANGE_MODE_STATIC, + Integer.class, mCarPropertyManager) + .addReadPermission(Car.PERMISSION_CAR_INFO) + .build(); + } + + @Test + public void testInfoModelYearIfSupported() { + getInfoModelYearVerifier().verify(); + } + private VehiclePropertyVerifier getInfoFuelCapacityVerifier() { return VehiclePropertyVerifier.newBuilder( VehiclePropertyIds.INFO_FUEL_CAPACITY, -- cgit v1.2.3 From 448b750aa7999a07cca433844caa08a6f26ced33 Mon Sep 17 00:00:00 2001 From: Wentao Wang Date: Tue, 13 Jun 2023 07:14:54 +0000 Subject: Make MODIFY_DAY_NIGHT_MODE and OBSERVE_APP_USAGE permissions grantable via role. Security approved for design: go/retail-demo-role-fr Bug: 274132354 Test: manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5535a37c8f213332020020565dedf15999c5a79a) Merged-In: Id8880eeb44070faebd79ab59cdd6a036898821cf Change-Id: Id8880eeb44070faebd79ab59cdd6a036898821cf --- tests/tests/permissionpolicy/res/raw/android_manifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tests/permissionpolicy/res/raw/android_manifest.xml b/tests/tests/permissionpolicy/res/raw/android_manifest.xml index fa6033ec367..83c658bce7a 100644 --- a/tests/tests/permissionpolicy/res/raw/android_manifest.xml +++ b/tests/tests/permissionpolicy/res/raw/android_manifest.xml @@ -5960,7 +5960,7 @@ + android:protectionLevel="signature|privileged|role" /> @@ -6591,7 +6591,7 @@ it will be ignored. @hide --> + android:protectionLevel="signature|privileged|role" />

A property is defined as all values that are present at a particular path. - * - * @param context to check mainline module version, as support varies by module version. */ - int getMaxIndexedProperties(@NonNull Context context); + int getMaxIndexedProperties(); } -- cgit v1.2.3 From 1d5a13f07a2c1e8665c42e0ac1f81a2e50af0cfb Mon Sep 17 00:00:00 2001 From: Julien Desprez Date: Tue, 5 Dec 2023 09:49:55 -0800 Subject: Update aapt check to aapt2 default have been changed, and docs are updated Test: presubmit Bug: 314921364 (cherry picked from https://android-review.googlesource.com/q/commit:42a4ec4da99037d34660020015000b784a3cf74f) Merged-In: Ibf055953b47d646477b62dd7102f9f2d6cc52631 Change-Id: Ibf055953b47d646477b62dd7102f9f2d6cc52631 --- tools/cts-tradefed/etc/cts-tradefed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cts-tradefed/etc/cts-tradefed b/tools/cts-tradefed/etc/cts-tradefed index 47fcea8c89d..4b477d08e2c 100755 --- a/tools/cts-tradefed/etc/cts-tradefed +++ b/tools/cts-tradefed/etc/cts-tradefed @@ -36,7 +36,7 @@ realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } -checkPath aapt +checkPath aapt2 checkPath adb checkPath java -- cgit v1.2.3