Merge "Revert "Add CTS for CarrierConfigManager public API.""
diff --git a/apps/CameraITS/tests/scene2_c/test_camera_launch_perf_class.py b/apps/CameraITS/tests/scene2_c/test_camera_launch_perf_class.py
index 47b152c..e7c7af8 100644
--- a/apps/CameraITS/tests/scene2_c/test_camera_launch_perf_class.py
+++ b/apps/CameraITS/tests/scene2_c/test_camera_launch_perf_class.py
@@ -22,6 +22,7 @@
 import its_base_test
 import its_session_utils
 
+# This must match MPC12_CAMERA_LAUNCH_THRESHOLD in ItsTestActivity.java
 CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD = 600  # ms
 
 
@@ -41,7 +42,7 @@
         camera_id=self.camera_id) as cam:
 
       camera_properties_utils.skip_unless(
-          cam.is_performance_class_primary_camera())
+          cam.is_primary_camera())
 
       # Load chart for scene.
       props = cam.get_camera_properties()
@@ -55,11 +56,17 @@
         camera_id=self.camera_id)
 
     launch_ms = cam.measure_camera_launch_ms()
-    if launch_ms >= CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD:
-      raise AssertionError(f'camera launch time: {launch_ms} ms, THRESH: '
-                           f'{CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD} ms')
-    else:
-      logging.debug('camera launch time: %.1f ms', launch_ms)
+
+    # Assert launch time if device claims performance class
+    if (cam.is_performance_class() and
+        launch_ms >= CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD):
+      raise AssertionError(f'camera_launch_time_ms: {launch_ms}, THRESH: '
+                           f'{CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD}')
+
+    # Log launch time, so that the corresponding MPC level can be written to
+    # report log. Text must match MPC12_CAMERA_LAUNCH_PATTERN in
+    # ItsTestActivity.java.
+    print(f'camera_launch_time_ms:{launch_ms}')
 
 if __name__ == '__main__':
   test_runner.main()
diff --git a/apps/CameraITS/tests/scene2_c/test_jpeg_capture_perf_class.py b/apps/CameraITS/tests/scene2_c/test_jpeg_capture_perf_class.py
index ba4867b..0eb76eb 100644
--- a/apps/CameraITS/tests/scene2_c/test_jpeg_capture_perf_class.py
+++ b/apps/CameraITS/tests/scene2_c/test_jpeg_capture_perf_class.py
@@ -22,13 +22,14 @@
 import its_base_test
 import its_session_utils
 
+# This must match MPC12_JPEG_CAPTURE_THRESHOLD in ItsTestActivity.java
 JPEG_CAPTURE_S_PERFORMANCE_CLASS_THRESHOLD = 1000  # ms
 
 
 class JpegCaptureSPerfClassTest(its_base_test.ItsBaseTest):
   """Test jpeg capture latency for S performance class as specified in CDD.
 
-  [7.5/H-1-6] MUST have camera2 JPEG capture latency < 1000ms for 1080p
+  [7.5/H-1-5] MUST have camera2 JPEG capture latency < 1000ms for 1080p
   resolution as measured by the CTS camera PerformanceTest under ITS lighting
   conditions (3000K) for both primary cameras.
   """
@@ -41,7 +42,7 @@
         camera_id=self.camera_id) as cam:
 
       camera_properties_utils.skip_unless(
-          cam.is_performance_class_primary_camera())
+          cam.is_primary_camera())
 
       # Load chart for scene.
       props = cam.get_camera_properties()
@@ -55,12 +56,18 @@
         camera_id=self.camera_id)
 
     jpeg_capture_ms = cam.measure_camera_1080p_jpeg_capture_ms()
-    if jpeg_capture_ms >= JPEG_CAPTURE_S_PERFORMANCE_CLASS_THRESHOLD:
-      raise AssertionError(f'1080p jpeg capture time: {jpeg_capture_ms} ms, '
+
+    # Assert jpeg capture time if device claims performance class
+    if (cam.is_performance_class() and
+        jpeg_capture_ms >= JPEG_CAPTURE_S_PERFORMANCE_CLASS_THRESHOLD):
+      raise AssertionError(f'1080p_jpeg_capture_time_ms: {jpeg_capture_ms}, '
                            f'THRESH: '
-                           f'{JPEG_CAPTURE_S_PERFORMANCE_CLASS_THRESHOLD} ms')
-    else:
-      logging.debug('1080p jpeg capture time: %.1f ms', jpeg_capture_ms)
+                           f'{JPEG_CAPTURE_S_PERFORMANCE_CLASS_THRESHOLD}')
+
+    # Log jpeg capture time so that the corresponding MPC level can be written
+    # to report log. Text must match MPC12_JPEG_CAPTURE_PATTERN in
+    # ItsTestActivity.java.
+    print(f'1080p_jpeg_capture_time_ms:{jpeg_capture_ms}')
 
 if __name__ == '__main__':
   test_runner.main()
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index eca0662..2ab0d73 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -16,6 +16,7 @@
 import logging
 import os
 import os.path
+import re
 import subprocess
 import sys
 import tempfile
@@ -41,6 +42,7 @@
 RESULT_FAIL = 'FAIL'
 RESULT_NOT_EXECUTED = 'NOT_EXECUTED'
 RESULT_KEY = 'result'
+METRICS_KEY = 'mpc_metrics'
 SUMMARY_KEY = 'summary'
 RESULT_VALUES = {RESULT_PASS, RESULT_FAIL, RESULT_NOT_EXECUTED}
 ITS_TEST_ACTIVITY = 'com.android.cts.verifier/.camera.its.ItsTestActivity'
@@ -450,6 +452,7 @@
     for s in per_camera_scenes:
       test_params_content['scene'] = s
       results[s]['TEST_STATUS'] = []
+      results[s][METRICS_KEY] = []
 
       # unit is millisecond for execution time record in CtsVerifier
       scene_start_time = int(round(time.time() * 1000))
@@ -525,14 +528,28 @@
             test_failed = False
             test_skipped = False
             test_not_yet_mandated = False
-            line = file.read()
-            if 'Test skipped' in line:
+            test_mpc_req = ""
+            content = file.read()
+
+            # Find media performance class logging
+            lines = content.splitlines()
+            for one_line in lines:
+              # regular expression pattern must match
+              # MPC12_CAMERA_LAUNCH_PATTERN or MPC12_JPEG_CAPTURE_PATTERN in
+              # ItsTestActivity.java.
+              mpc_string_match = re.search(
+                  '^(1080p_jpeg_capture_time_ms:|camera_launch_time_ms:)', one_line)
+              if mpc_string_match:
+                test_mpc_req = one_line
+                break
+
+            if 'Test skipped' in content:
               return_string = 'SKIP '
               num_skip += 1
               test_skipped = True
               break
 
-            if 'Not yet mandated test' in line:
+            if 'Not yet mandated test' in content:
               return_string = 'FAIL*'
               num_not_mandated_fail += 1
               test_not_yet_mandated = True
@@ -545,7 +562,7 @@
 
             if test_code == 1 and not test_not_yet_mandated:
               return_string = 'FAIL '
-              if 'Problem with socket' in line and num_try != NUM_TRIES-1:
+              if 'Problem with socket' in content and num_try != NUM_TRIES-1:
                 logging.info('Retry %s/%s', s, test)
               else:
                 num_fail += 1
@@ -555,6 +572,8 @@
         logging.info('%s %s/%s', return_string, s, test)
         test_name = test.split('/')[-1].split('.')[0]
         results[s]['TEST_STATUS'].append({'test':test_name,'status':return_string.strip()})
+        if test_mpc_req:
+          results[s][METRICS_KEY].append(test_mpc_req)
         msg_short = '%s %s' % (return_string, test)
         scene_test_summary += msg_short + '\n'
 
diff --git a/apps/CameraITS/utils/its_session_utils.py b/apps/CameraITS/utils/its_session_utils.py
index 00b65cc..67f0626 100644
--- a/apps/CameraITS/utils/its_session_utils.py
+++ b/apps/CameraITS/utils/its_session_utils.py
@@ -1097,8 +1097,8 @@
                                       ' support')
     return data['strValue'] == 'true'
 
-  def is_performance_class_primary_camera(self):
-    """Query whether the camera device is an R or S performance class primary camera.
+  def is_primary_camera(self):
+    """Query whether the camera device is a primary rear/front camera.
 
     A primary rear/front facing camera is a camera device with the lowest
     camera Id for that facing.
@@ -1107,14 +1107,28 @@
       Boolean
     """
     cmd = {}
-    cmd['cmdName'] = 'isPerformanceClassPrimaryCamera'
+    cmd['cmdName'] = 'isPrimaryCamera'
     cmd['cameraId'] = self._camera_id
     self.sock.send(json.dumps(cmd).encode() + '\n'.encode())
 
     data, _ = self.__read_response_from_socket()
-    if data['tag'] != 'performanceClassPrimaryCamera':
-      raise error_util.CameraItsError('Failed to query performance class '
-                                      'primary camera')
+    if data['tag'] != 'primaryCamera':
+      raise error_util.CameraItsError('Failed to query primary camera')
+    return data['strValue'] == 'true'
+
+  def is_performance_class(self):
+    """Query whether the mobile device is an R or S performance class device.
+
+    Returns:
+      Boolean
+    """
+    cmd = {}
+    cmd['cmdName'] = 'isPerformanceClass'
+    self.sock.send(json.dumps(cmd).encode() + '\n'.encode())
+
+    data, _ = self.__read_response_from_socket()
+    if data['tag'] != 'performanceClass':
+      raise error_util.CameraItsError('Failed to query performance class')
     return data['strValue'] == 'true'
 
   def measure_camera_launch_ms(self):
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
index 495c3ef..e34dce1 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
@@ -83,31 +83,39 @@
             Log.d(TAG, "copyReportFiles(" + tempDir.getAbsolutePath() + ")");
         }
 
-        File externalStorageDirectory = Environment.getExternalStorageDirectory();
         File reportLogFolder =
                 new File(Environment.getExternalStorageDirectory().getAbsolutePath()
                         + File.separator
                         + LOGS_DIRECTORY);
-        File[] reportLogFiles = reportLogFolder.listFiles();
 
-        // if no ReportLog files have been created (i.e. the folder doesn't exist)
-        // then listFiles() returns null. Handle silently.
-        if (reportLogFiles != null) {
-            for (File reportLogFile : reportLogFiles) {
-                Path src = Paths.get(reportLogFile.getAbsolutePath());
-                Path dest = Paths.get(
-                        tempDir.getAbsolutePath()
-                                + File.separator
-                                + reportLogFile.getName());
-                try {
-                    Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
-                } catch (IOException ex) {
-                    LOG.log(Level.WARNING, "Error copying ReportLog files. IOException: " + ex);
-                }
+        copyFilesRecursively(reportLogFolder, tempDir);
+    }
+
+    private void copyFilesRecursively(File source, File destFolder) {
+        File[] files = source.listFiles();
+
+        if (files == null) {
+            return;
+        }
+
+        for (File file : files) {
+            Path src = Paths.get(file.getAbsolutePath());
+            Path dest = Paths.get(
+                    destFolder.getAbsolutePath()
+                            + File.separator
+                            + file.getName());
+            try {
+                Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
+            } catch (IOException ex) {
+                LOG.log(Level.WARNING, "Error copying ReportLog file. IOException: " + ex);
+            }
+            if (file.isDirectory()) {
+                copyFilesRecursively(file, dest.toFile());
             }
         }
     }
 
+
     @Override
     protected String doInBackground(Void... params) {
         if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index 3b12101..1651ec5 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -150,8 +150,6 @@
 
     // Performance class R version number
     private static final int PERFORMANCE_CLASS_R = Build.VERSION_CODES.R;
-    // Performance class S version number
-    private static final int PERFORMANCE_CLASS_S = Build.VERSION_CODES.R + 1;
 
     public static final int SERVERPORT = 6000;
 
@@ -738,9 +736,11 @@
                     doCheckStreamCombination(cmdObj);
                 } else if ("isCameraPrivacyModeSupported".equals(cmdObj.getString("cmdName"))) {
                     doCheckCameraPrivacyModeSupport();
-                } else if ("isPerformanceClassPrimaryCamera".equals(cmdObj.getString("cmdName"))) {
+                } else if ("isPrimaryCamera".equals(cmdObj.getString("cmdName"))) {
                     String cameraId = cmdObj.getString("cameraId");
-                    doCheckPerformanceClassPrimaryCamera(cameraId);
+                    doCheckPrimaryCamera(cameraId);
+                } else if ("isPerformanceClass".equals(cmdObj.getString("cmdName"))) {
+                    doCheckPerformanceClass();
                 } else if ("measureCameraLaunchMs".equals(cmdObj.getString("cmdName"))) {
                     String cameraId = cmdObj.getString("cameraId");
                     doMeasureCameraLaunchMs(cameraId);
@@ -1083,10 +1083,7 @@
                 hasPrivacySupport ? "true" : "false");
     }
 
-    private void doCheckPerformanceClassPrimaryCamera(String cameraId) throws ItsException {
-        boolean  isPerfClass = (Build.VERSION.MEDIA_PERFORMANCE_CLASS == PERFORMANCE_CLASS_S
-                || Build.VERSION.MEDIA_PERFORMANCE_CLASS == PERFORMANCE_CLASS_R);
-
+    private void doCheckPrimaryCamera(String cameraId) throws ItsException {
         if (mItsCameraIdList == null) {
             mItsCameraIdList = ItsUtils.getItsCompatibleCameraIds(mCameraManager);
         }
@@ -1117,8 +1114,15 @@
             throw new ItsException("Failed to get camera characteristics", e);
         }
 
-        mSocketRunnableObj.sendResponse("performanceClassPrimaryCamera",
-                (isPerfClass && isPrimaryCamera) ? "true" : "false");
+        mSocketRunnableObj.sendResponse("primaryCamera",
+                isPrimaryCamera ? "true" : "false");
+    }
+
+    private void doCheckPerformanceClass() throws ItsException {
+        boolean  isPerfClass = (Build.VERSION.MEDIA_PERFORMANCE_CLASS >= PERFORMANCE_CLASS_R);
+
+        mSocketRunnableObj.sendResponse("performanceClass",
+                isPerfClass ? "true" : "false");
     }
 
     private double invokeCameraPerformanceTest(Class testClass, String testName,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
index 08cd8b2..c8725bb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
@@ -41,6 +41,9 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.FileNotFoundException;
@@ -77,6 +80,17 @@
             Arrays.asList(new String[] {RESULT_PASS, RESULT_FAIL, RESULT_NOT_EXECUTED}));
     private static final int MAX_SUMMARY_LEN = 200;
 
+    private static final int MPC12_CAMERA_LAUNCH_THRESHOLD = 600; // ms
+    private static final int MPC12_JPEG_CAPTURE_THRESHOLD = 1000; // ms
+
+    private static final String MPC_TESTS_REPORT_LOG_NAME = "MediaPerformanceClassLogs";
+    private static final String MPC_TESTS_REPORT_LOG_SECTION = "CameraIts";
+
+    private static final Pattern MPC12_CAMERA_LAUNCH_PATTERN =
+            Pattern.compile("camera_launch_time_ms:(\\d+(\\.\\d+)?)");
+    private static final Pattern MPC12_JPEG_CAPTURE_PATTERN =
+            Pattern.compile("1080p_jpeg_capture_time_ms:(\\d+(\\.\\d+)?)");
+
     private final ResultReceiver mResultsReceiver = new ResultReceiver();
     private boolean mReceiverRegistered = false;
 
@@ -116,6 +130,10 @@
     private final HashMap<ResultKey, Boolean> mExecutedScenes = new HashMap<>();
     // map camera id to ITS summary report path
     private final HashMap<ResultKey, String> mSummaryMap = new HashMap<>();
+    // All primary cameras for which MPC level test has run
+    private Set<ResultKey> mExecutedMpcTests = null;
+    // Map primary camera id to MPC level
+    private final HashMap<String, Integer> mMpcLevelMap = new HashMap<>();
 
     final class ResultKey {
         public final String cameraId;
@@ -213,7 +231,6 @@
 
                     // Update test execution results
                     for (String scene : scenes) {
-                        HashMap<String, String> executedTests = new HashMap<>();
                         JSONObject sceneResult = jsonResults.getJSONObject(scene);
                         Log.v(TAG, sceneResult.toString());
                         String result = sceneResult.getString("result");
@@ -241,6 +258,22 @@
                                 mSummaryMap.put(key, summary);
                             }
                         } // do nothing for NOT_EXECUTED scenes
+
+                        if (sceneResult.isNull("mpc_metrics")) {
+                            continue;
+                        }
+                        // Update MPC level
+                        JSONArray metrics = sceneResult.getJSONArray("mpc_metrics");
+                        for (int i = 0; i < metrics.length(); i++) {
+                            String mpcResult = metrics.getString(i);
+                            if (!matchMpcResult(cameraId, mpcResult, MPC12_CAMERA_LAUNCH_PATTERN,
+                                    "2.2.7.2/7.5/H-1-6", MPC12_CAMERA_LAUNCH_THRESHOLD) &&
+                                    !matchMpcResult(cameraId, mpcResult, MPC12_JPEG_CAPTURE_PATTERN,
+                                    "2.2.7.2/7.5/H-1-5", MPC12_JPEG_CAPTURE_THRESHOLD)) {
+                                Log.e(TAG, "Error parsing MPC result string:" + mpcResult);
+                                return;
+                            }
+                        }
                     }
                 } catch (org.json.JSONException e) {
                     Log.e(TAG, "Error reading json result string:" + results , e);
@@ -249,6 +282,7 @@
 
                 // Set summary if all scenes reported
                 if (mSummaryMap.keySet().containsAll(mAllScenes)) {
+                    // Save test summary
                     StringBuilder summary = new StringBuilder();
                     for (String path : mSummaryMap.values()) {
                         appendFileContentToSummary(summary, path);
@@ -260,6 +294,17 @@
                             summary.toString(), 1.0, ResultType.NEUTRAL, ResultUnit.NONE);
                 }
 
+                //  Save MPC info once both front primary and rear primary data are collected.
+                if (mExecutedMpcTests.size() == 4) {
+                    ItsTestActivity.this.getReportLog().addValue(
+                            "Version", "0.0.1", ResultType.NEUTRAL, ResultUnit.NONE);
+                    for (Map.Entry<String, Integer> entry : mMpcLevelMap.entrySet()) {
+                        ItsTestActivity.this.getReportLog().addValue(entry.getKey(),
+                                entry.getValue(), ResultType.NEUTRAL, ResultUnit.NONE);
+                    }
+                    ItsTestActivity.this.getReportLog().submit();
+                }
+
                 // Display current progress
                 StringBuilder progress = new StringBuilder();
                 for (ResultKey k : mAllScenes) {
@@ -321,6 +366,29 @@
                 }
             }
         }
+
+        private boolean matchMpcResult(String cameraId, String mpcResult, Pattern pattern,
+                String reqNum, float threshold) {
+            Matcher matcher = pattern.matcher(mpcResult);
+            boolean match = matcher.matches();
+
+            if (match) {
+                // Store test result
+                ItsTestActivity.this.getReportLog().addValue("Cam" + cameraId,
+                        mpcResult, ResultType.NEUTRAL, ResultUnit.NONE);
+
+                float latency = Float.parseFloat(matcher.group(1));
+                int mpcLevel = latency < threshold ? 31 : 0;
+                mExecutedMpcTests.add(new ResultKey(cameraId, reqNum));
+
+                if (mMpcLevelMap.containsKey(reqNum)) {
+                    mpcLevel = Math.min(mpcLevel, mMpcLevelMap.get(reqNum));
+                }
+                mMpcLevelMap.put(reqNum, mpcLevel);
+            }
+
+            return match;
+        }
     }
 
     @Override
@@ -388,6 +456,9 @@
                 testTitle(cam, scene),
                 testId(cam, scene)));
             }
+            if (mExecutedMpcTests == null) {
+                mExecutedMpcTests = new TreeSet<>(mComparator);
+            }
             Log.d(TAG,"Total combinations to test on this device:" + mAllScenes.size());
         }
     }
@@ -427,4 +498,14 @@
         setInfoResources(R.string.camera_its_test, R.string.camera_its_test_info, -1);
         setPassFailButtonClickListeners();
     }
+
+    @Override
+    public String getReportFileName() {
+        return MPC_TESTS_REPORT_LOG_NAME;
+    }
+
+    @Override
+    public String getReportSectionName() {
+        return MPC_TESTS_REPORT_LOG_SECTION;
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/IntentFiltersTestHelper.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/IntentFiltersTestHelper.java
index 70aaab5..09c1c9c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/IntentFiltersTestHelper.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/IntentFiltersTestHelper.java
@@ -16,34 +16,27 @@
 
 package com.android.cts.verifier.managedprovisioning;
 
-import android.app.Activity;
-import android.app.admin.DevicePolicyManager;
 import android.app.DownloadManager;
-import android.content.ComponentName;
+import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
-import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.media.audiofx.AudioEffect;
 import android.net.Uri;
 import android.nfc.cardemulation.CardEmulation;
 import android.os.Build;
-import android.os.Bundle;
 import android.os.Environment;
-import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.AlarmClock;
 import android.provider.CalendarContract.Events;
 import android.provider.MediaStore;
 import android.provider.Settings;
-import android.speech.RecognizerIntent;
 import android.util.Log;
-import android.widget.Toast;
 
-import java.util.Arrays;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -161,7 +154,7 @@
         PackageManager pm = mContext.getPackageManager();
 
         if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                && pm.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) {
+                && pm.hasSystemFeature(PackageManager.FEATURE_TELECOM)) {
             forwardedIntentsFromManaged.addAll(Arrays.asList(
                     new Intent("android.intent.action.CALL_EMERGENCY").setData(
                             Uri.parse("tel:123")),
diff --git a/common/device-side/bedstead/harrier/Android.bp b/common/device-side/bedstead/harrier/Android.bp
index e1c1135..f0f19cf 100644
--- a/common/device-side/bedstead/harrier/Android.bp
+++ b/common/device-side/bedstead/harrier/Android.bp
@@ -16,6 +16,40 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
+java_library_host {
+    name: "HarrierCommon",
+    srcs: [
+        "common/src/main/java/**/*.java",
+    ],
+
+    static_libs: [
+        "junit",
+        "auto_value_annotations",
+        "guava",
+        "NeneCommon"
+    ],
+
+    plugins: ["auto_annotation_plugin"]
+}
+
+android_library {
+    name: "HarrierCommonAndroid",
+    srcs: [
+        "common/src/main/java/**/*.java",
+    ],
+
+    static_libs: [
+        "junit",
+        "auto_value_annotations",
+        "guava",
+        "NeneCommonAndroid"
+    ],
+
+    manifest: "src/main/AndroidManifest.xml",
+    min_sdk_version: "27",
+    plugins: ["auto_annotation_plugin"]
+}
+
 android_library {
     name: "Harrier",
     sdk_version: "test_current",
@@ -27,6 +61,7 @@
     static_libs: [
         "Nene",
         "RemoteDPC",
+        "HarrierCommonAndroid",
         "compatibility-device-util-axt",
         "androidx.test.ext.junit",
         "auto_value_annotations"
@@ -34,7 +69,6 @@
 
     manifest: "src/main/AndroidManifest.xml",
     min_sdk_version: "27",
-    plugins: ["auto_annotation_plugin"],
 }
 
 android_test {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java
similarity index 95%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java
index b6475d6..77bb8d1 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadFrameworkMethod.java
@@ -16,8 +16,6 @@
 
 package com.android.bedstead.harrier;
 
-import androidx.annotation.Nullable;
-
 import com.google.common.base.Objects;
 
 import org.junit.runners.model.FrameworkMethod;
@@ -31,6 +29,8 @@
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import javax.annotation.Nullable;
+
 /**
  * {@link FrameworkMethod} subclass which allows modifying the test name and annotations.
  */
@@ -45,7 +45,8 @@
         this(method, /* parameterizedAnnotation= */ null);
     }
 
-    public BedsteadFrameworkMethod(Method method, @Nullable Annotation parameterizedAnnotation) {
+    public BedsteadFrameworkMethod(Method method,
+            @Nullable Annotation parameterizedAnnotation) {
         super(method);
         mParameterizedAnnotation = parameterizedAnnotation;
 
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
index e2c1d73..646291a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
@@ -16,11 +16,6 @@
 
 package com.android.bedstead.harrier;
 
-import android.os.Bundle;
-
-import androidx.annotation.Nullable;
-import androidx.test.platform.app.InstrumentationRegistry;
-
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.IntTestParameter;
 import com.android.bedstead.harrier.annotations.StringTestParameter;
@@ -32,6 +27,7 @@
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeNone;
+import com.android.bedstead.nene.annotations.Nullable;
 import com.android.bedstead.nene.exceptions.NeneException;
 
 import org.junit.Test;
@@ -460,11 +456,11 @@
         List<TestRule> rules = super.classRules();
 
         for (TestRule rule : rules) {
-            if (rule instanceof DeviceState) {
-                DeviceState deviceState = (DeviceState) rule;
+            if (rule instanceof HarrierRule) {
+                HarrierRule harrierRule = (HarrierRule) rule;
 
-                deviceState.setSkipTestTeardown(true);
-                deviceState.setUsingBedsteadJUnit4(true);
+                harrierRule.setSkipTestTeardown(true);
+                harrierRule.setUsingBedsteadJUnit4(true);
 
                 break;
             }
@@ -482,8 +478,20 @@
      * <p>To enable this, pass the "bedstead-debug" instrumentation arg as "true"
      */
     public static boolean isDebug() {
-        Bundle arguments = InstrumentationRegistry.getArguments();
-        return Boolean.parseBoolean(arguments.getString("bedstead-debug", "false"));
+        try {
+            Class instrumentationRegistryClass = Class.forName(
+                        "androidx.test.platform.app.InstrumentationRegistry");
+
+            Object arguments = instrumentationRegistryClass.getMethod("getArguments")
+                    .invoke(null);
+            return Boolean.parseBoolean((String) arguments.getClass()
+                    .getMethod("getString", String.class, String.class)
+                    .invoke(arguments, "bedstead-debug", "false"));
+        } catch (ClassNotFoundException e) {
+            return false; // Must be on the host so can't access debug information
+        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+            throw new IllegalStateException("Error getting isDebug", e);
+        }
     }
 
     @Override
diff --git a/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Defaults.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Defaults.java
new file mode 100644
index 0000000..13320bc
--- /dev/null
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Defaults.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.harrier;
+
+/** Default values used across Harrier. */
+public final class Defaults {
+
+    private Defaults() {
+
+    }
+
+    /**
+     * The password to be used in tests.
+     *
+     * The infrastructure will use this password when a password exists and is required.
+     */
+    public static final String DEFAULT_PASSWORD = "1234";
+
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/FrameworkMethodWithParameter.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/FrameworkMethodWithParameter.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/FrameworkMethodWithParameter.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/FrameworkMethodWithParameter.java
diff --git a/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/HarrierRule.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/HarrierRule.java
new file mode 100644
index 0000000..35bc955
--- /dev/null
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/HarrierRule.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.harrier;
+
+import org.junit.rules.TestRule;
+
+/** A @Rule used on device by Harrier. */
+public abstract class HarrierRule implements TestRule {
+    /** Set that we should skip tearing down between tests. */
+    abstract void setSkipTestTeardown(boolean skipTestTeardown);
+    /** Set that we are using the BedsteadJUnit4 test runner. */
+    abstract void setUsingBedsteadJUnit4(boolean usingBedsteadJUnit4);
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/OptionalBoolean.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/OptionalBoolean.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/OptionalBoolean.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/OptionalBoolean.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Policy.java
similarity index 95%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Policy.java
index 9a90ef4..d7ea1bd 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/Policy.java
@@ -16,18 +16,6 @@
 
 package com.android.bedstead.harrier;
 
-import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
-import static android.app.admin.DevicePolicyManager.DELEGATION_BLOCK_UNINSTALL;
-import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_INSTALL;
-import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_SELECTION;
-import static android.app.admin.DevicePolicyManager.DELEGATION_ENABLE_SYSTEM_APP;
-import static android.app.admin.DevicePolicyManager.DELEGATION_INSTALL_EXISTING_PACKAGE;
-import static android.app.admin.DevicePolicyManager.DELEGATION_KEEP_UNINSTALLED_PACKAGES;
-import static android.app.admin.DevicePolicyManager.DELEGATION_NETWORK_LOGGING;
-import static android.app.admin.DevicePolicyManager.DELEGATION_PACKAGE_ACCESS;
-import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
-import static android.app.admin.DevicePolicyManager.DELEGATION_SECURITY_LOGGING;
-
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_AFFILIATED_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_AFFILIATED_PROFILE_OWNER_PROFILE;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER;
@@ -44,6 +32,17 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.CAN_BE_DELEGATED;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DO_NOT_APPLY_TO_NEGATIVE_TESTS;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.NO;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_APP_RESTRICTIONS;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_BLOCK_UNINSTALL;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_CERT_INSTALL;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_CERT_SELECTION;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_ENABLE_SYSTEM_APP;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_INSTALL_EXISTING_PACKAGE;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_KEEP_UNINSTALLED_PACKAGES;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_NETWORK_LOGGING;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_PACKAGE_ACCESS;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_PERMISSION_GRANT;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_SECURITY_LOGGING;
 
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate;
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
@@ -403,7 +402,8 @@
                 Annotation[] newAnnotations = Arrays.copyOf(existingAnnotations,
                         existingAnnotations.length + 1);
                 newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
-                        EnsureHasDelegate.AdminType.PRIMARY, new String[]{}, /* isPrimary= */ true);
+                        EnsureHasDelegate.AdminType.PRIMARY, new String[]{},
+                        /* isPrimary= */ true);
                 annotations.add(
                         new DynamicParameterizedAnnotation("DelegateWithNoScopes", newAnnotations));
 
@@ -411,7 +411,8 @@
                     newAnnotations = Arrays.copyOf(existingAnnotations,
                             existingAnnotations.length + 1);
                     newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
-                            EnsureHasDelegate.AdminType.PRIMARY, new String[]{scope}, /* isPrimary= */ true);
+                            EnsureHasDelegate.AdminType.PRIMARY, new String[]{scope},
+                            /* isPrimary= */ true);
                     annotations.add(
                             new DynamicParameterizedAnnotation("DelegateWithScope:" + scope, newAnnotations));
                 }
diff --git a/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/UserType.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/UserType.java
new file mode 100644
index 0000000..9dacdae
--- /dev/null
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/UserType.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.harrier;
+
+public enum UserType {
+    /** Only to be used with annotations. */
+    ANY,
+    SYSTEM_USER,
+    CURRENT_USER,
+    PRIMARY_USER,
+    SECONDARY_USER,
+    WORK_PROFILE,
+    TV_PROFILE,
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java
index 1241503..3bb6449 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/AfterClass.java
@@ -16,15 +16,13 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Replacement for {@link org.junit.AfterClass} for use by classes which use {@link DeviceState}.
+ * Replacement for {@link org.junit.AfterClass} for use by classes which use {@code Devicestate}.
  *
  * <p>Methods annotated {@link AfterClass} must be public, static, must return {@code void}, and
  * must take no arguments.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java
index 5f76ba6..f6de30a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/BeforeClass.java
@@ -16,15 +16,13 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Replacement for {@link org.junit.BeforeClass} for use by classes which use {@link DeviceState}.
+ * Replacement for {@link org.junit.BeforeClass} for use by classes which use {@code Devicestate}.
  *
  * <p>Methods annotated {@link BeforeClass} must be public, static, must return {@code void}, and
  * must take no arguments.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
similarity index 95%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
index 3cb8104..7e65661 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
@@ -18,7 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoUserAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -31,7 +30,7 @@
  * instrumented user.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device which
- * has no secondary user that is not the current user. Otherwise, you can use {@link DeviceState}
+ * has no secondary user that is not the current user. Otherwise, you can use {@code Devicestate}
  * to ensure that the device enters the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
index 50dac4d..d4b1c94 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoProfileAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -31,7 +31,7 @@
  * Mark that a test method should run on a user which has no Tv profile.
  *
  * <p>Your test configuration may be configured so that this test is only run on a user which has
- * no Tv profile. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * no Tv profile. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -39,7 +39,7 @@
 @EnsureHasNoProfileAnnotation("com.android.tv.profile")
 public @interface EnsureHasNoTvProfile {
     /** Which user type the tv profile should not be attached to. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
index bec8a6b..d3693dd 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoProfileAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -31,7 +31,7 @@
  * Mark that a test method should run on a user which does not have a work profile.
  *
  * <p>Your test configuration may be configured so that this test is only run on a user which has
- * no work profile. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * no work profile. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -40,7 +40,7 @@
 @RequireFeature("android.software.managed_users")
 public @interface EnsureHasNoWorkProfile {
     /** Which user type the work profile should not be attached to. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
index 186d86b..6113175 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
@@ -20,7 +20,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasUserAnnotation;
 
@@ -33,7 +32,7 @@
  * Mark that a test method should run on a device which has a secondary user.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device which
- * has a secondary user that is not the current user. Otherwise, you can use {@link DeviceState}
+ * has a secondary user that is not the current user. Otherwise, you can use {@code Devicestate}
  * to ensure that the device enters the correct state for the method. If there is not already a
  * secondary user on the device, and the device does not support creating additional users, then
  * the test will be skipped.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
similarity index 90%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
index 35f3283..aa4fbfe 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
@@ -16,13 +16,13 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.OptionalBoolean.ANY;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasProfileAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -34,7 +34,7 @@
  * Mark that a test method should run on a user which has a Tv profile.
  *
  * <p>Your test configuration may be configured so that this test is only run on a user which has
- * a Tv profile. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * a Tv profile. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -42,7 +42,7 @@
 @EnsureHasProfileAnnotation("com.android.tv.profile")
 public @interface EnsureHasTvProfile {
     /** Which user type the tv profile should be attached to. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /** Whether the instrumented test app should be installed in the tv profile. */
     OptionalBoolean installInstrumentedApp() default TRUE;
@@ -63,4 +63,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default MIDDLE;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
index a0f51b4..99badd8 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
@@ -16,16 +16,13 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.OptionalBoolean.ANY;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasProfileAnnotation;
 
@@ -41,7 +38,7 @@
  * {@code RequireFeature("android.software.managed_users", SKIP)}.
  *
  * <p>Your test configuration may be configured so that this test is only run on a user which has
- * a work profile. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * a work profile. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -51,20 +48,20 @@
 @EnsureHasNoDeviceOwner // TODO: This should only apply on Android R+
 public @interface EnsureHasWorkProfile {
     /** Which user type the work profile should be attached to. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /** Whether the instrumented test app should be installed in the work profile. */
     OptionalBoolean installInstrumentedApp() default TRUE;
 
     /**
-     * Whether the profile owner's DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether the profile owner's DPC should be returned by calls to {@code Devicestate#dpc()}.
      *
      * <p>Only one device policy controller per test should be marked as primary.
      */
     boolean dpcIsPrimary() default false;
 
     /**
-     * If true, uses the {@link DevicePolicyManager#getParentProfileInstance(ComponentName)}
+     * If true, uses the {@code DevicePolicyManager#getParentProfileInstance(ComponentName)}
      * instance of the dpc when calling to .dpc()
      *
      * <p>Only used if {@link #dpcIsPrimary()} is true.
@@ -87,4 +84,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default MIDDLE;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
index 9ce07a7..c87abb8 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
@@ -18,7 +18,7 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Repeatable;
@@ -41,7 +41,7 @@
 @Repeatable(EnsurePackagesNotInstalled.class)
 public @interface EnsurePackageNotInstalled {
     String value();
-    DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
+    UserType onUser() default UserType.CURRENT_USER;
 
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java
similarity index 87%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java
index 0bcd1d4..fe2dd5e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordNotSet.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -29,7 +29,7 @@
 /**
  * Mark that a test method requires no password be set on the given user.
  *
- * <p>You can use {@link DeviceState} to ensure that the device enters
+ * <p>You can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -37,7 +37,7 @@
 public @interface EnsurePasswordNotSet {
 
     /** The user who must not have a password. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java
similarity index 82%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java
index 63f4bba..da2a09d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsurePasswordSet.java
@@ -16,11 +16,11 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static com.android.bedstead.harrier.DeviceState.DEFAULT_PASSWORD;
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.Defaults.DEFAULT_PASSWORD;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -30,7 +30,7 @@
 /**
  * Mark that a test method requires a password be set on the given user.
  *
- * <p>You can use {@link DeviceState} to ensure that the device enters
+ * <p>You can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -38,9 +38,9 @@
 public @interface EnsurePasswordSet {
 
     /** The user who must have a password. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
-    /** The password to set. Defaults to {@link DeviceState#DEFAULT_PASSWORD}. */
+    /** The password to set. Defaults to {@code Devicestate#DEFAULT_PASSWORD}. */
     String password() default DEFAULT_PASSWORD;
 
     /**
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java
similarity index 93%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java
index 10c579c..10eb715 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/EnsureScreenIsOn.java
@@ -18,8 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -28,7 +26,7 @@
 /**
  * Mark that a test method requires the screen to be on.
  *
- * <p>You can use {@link DeviceState} to ensure that the device enters
+ * <p>You can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/FailureMode.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/FailureMode.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/FailureMode.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/FailureMode.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/IntTestParameter.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/IntTestParameter.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/IntTestParameter.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/IntTestParameter.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
index 830fa10..6c9c008 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
@@ -21,7 +21,7 @@
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GSF_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.PLAY_STORE_PACKAGE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -30,9 +30,9 @@
 
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@RequirePackageNotInstalled(value = GMS_CORE_PACKAGE, onUser = DeviceState.UserType.ANY)
-@RequirePackageNotInstalled(value = PLAY_STORE_PACKAGE, onUser = DeviceState.UserType.ANY)
-@RequirePackageNotInstalled(value = GSF_PACKAGE, onUser = DeviceState.UserType.ANY)
+@RequirePackageNotInstalled(value = GMS_CORE_PACKAGE, onUser = UserType.ANY)
+@RequirePackageNotInstalled(value = PLAY_STORE_PACKAGE, onUser = UserType.ANY)
+@RequirePackageNotInstalled(value = GSF_PACKAGE, onUser = UserType.ANY)
 public @interface RequireAospBuild {
     String GMS_CORE_PACKAGE = "com.google.android.gms";
     String PLAY_STORE_PACKAGE = "com.android.vending";
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
similarity index 99%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
index bbef533..2fc40f6 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
@@ -42,4 +42,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default EARLY;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
similarity index 85%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
index 48e7984..86323c0 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
@@ -21,7 +21,7 @@
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GSF_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.PLAY_STORE_PACKAGE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -30,9 +30,9 @@
 
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@RequirePackageInstalled(value = GMS_CORE_PACKAGE, onUser = DeviceState.UserType.ANY)
-@RequirePackageInstalled(value = PLAY_STORE_PACKAGE, onUser = DeviceState.UserType.ANY)
-@RequirePackageInstalled(value = GSF_PACKAGE, onUser = DeviceState.UserType.ANY)
+@RequirePackageInstalled(value = GMS_CORE_PACKAGE, onUser = UserType.ANY)
+@RequirePackageInstalled(value = PLAY_STORE_PACKAGE, onUser = UserType.ANY)
+@RequirePackageInstalled(value = GSF_PACKAGE, onUser = UserType.ANY)
 public @interface RequireGmsBuild {
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
similarity index 91%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
index 257cc2f..5fb415f 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
@@ -16,8 +16,6 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -26,7 +24,7 @@
 /**
  * Annotation to indicate that a test requires a low ram device.
  *
- * <p>This can be enforced by using {@link DeviceState}.
+ * <p>This can be enforced by using {@code Devicestate}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
similarity index 91%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
index 8d90920..5041014 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
@@ -16,8 +16,6 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -26,7 +24,7 @@
 /**
  * Annotation to indicate that a test does not run on low ram devices.
  *
- * <p>This can be enforced by using {@link DeviceState}.
+ * <p>This can be enforced by using {@code Devicestate}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
index e2f3196..7cd5717 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
@@ -18,7 +18,7 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Repeatable;
@@ -40,7 +40,7 @@
 @Repeatable(RequirePackagesInstalled.class)
 public @interface RequirePackageInstalled {
     String value();
-    DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
+    UserType onUser() default UserType.CURRENT_USER;
     FailureMode failureMode() default FailureMode.SKIP;
 
     /**
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
index 36375c1..747eb5d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
@@ -18,7 +18,7 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Repeatable;
@@ -41,7 +41,7 @@
 @Repeatable(RequirePackagesNotInstalled.class)
 public @interface RequirePackageNotInstalled {
     String value();
-    DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
+    UserType onUser() default UserType.CURRENT_USER;
     FailureMode failureMode() default FailureMode.SKIP;
 
     /**
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
index 446bb85..5e84335 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
@@ -18,8 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -32,7 +30,7 @@
  * is created and the test is being run on that user.
  *
  * <p>Optionally, you can guarantee that these methods do not run on a secondary user by
- * using {@link DeviceState}.
+ * using {@code Devicestate}.
  *
  * <p>This annotation by default opts a test into multi-user presubmit. New tests should also be
  * annotated {@link Postsubmit} until they are shown to meet the multi-user presubmit
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
index a58eb28..3f937af 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
@@ -19,7 +19,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.meta.RequireRunOnUserAnnotation;
 
@@ -34,7 +33,7 @@
  * <p>Your test configuration should be such that this test is only run on the primary user
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of the primary
- * user by using {@link DeviceState}.
+ * user by using {@code Devicestate}.
  *
  * <p>Note that in practice this requires that the test runs on the system user, but excludes
  * headless system users. To mark that a test should run on the system user, including headless
@@ -60,4 +59,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default EARLY;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
index b3df118..08734ea 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
@@ -19,7 +19,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.meta.RequireRunOnUserAnnotation;
 
@@ -35,7 +34,7 @@
  * created and the test is being run on that user.
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of a secondary user by
- * using {@link DeviceState}.
+ * using {@code Devicestate}.
  *
  * <p>This annotation by default opts a test into multi-user presubmit. New tests should also be
  * annotated {@link Postsubmit} until they are shown to meet the multi-user presubmit
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
index 52c927e..03321ce 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
@@ -19,7 +19,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.meta.RequireRunOnUserAnnotation;
 
@@ -34,7 +33,7 @@
  * <p>Your test configuration should be such that this test is only run on the system user
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of the system
- * user by using {@link DeviceState}.
+ * user by using {@code Devicestate}.
  *
  * <p>Note that this requires that the test runs on the system user, including headless system
  * users. To mark that a test should run on the primary user, excluding headless
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
similarity index 96%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
index c2daad9..b5ab38c 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
@@ -20,7 +20,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.meta.RequireRunOnProfileAnnotation;
 
@@ -36,7 +35,7 @@
  * created and the test is being run within that user.
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of a Tv
- * profile by using {@link DeviceState}.
+ * profile by using {@code Devicestate}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
@@ -60,4 +59,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default EARLY;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
similarity index 92%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
index b06a909..b811fff 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
@@ -16,13 +16,11 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
-
 import static com.android.bedstead.harrier.OptionalBoolean.ANY;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+import static com.android.bedstead.nene.packages.CommonPackages.FEATURE_DEVICE_ADMIN;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
 import com.android.bedstead.harrier.annotations.meta.RequireRunOnProfileAnnotation;
@@ -39,21 +37,22 @@
  * created and the test is being run within that user.
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of a work
- * profile by using {@link DeviceState}.
+ * profile by using {@code Devicestate}.
  *
  * <p>This annotation by default opts a test into multi-user presubmit. New tests should also be
  * annotated {@link Postsubmit} until they are shown to meet the multi-user presubmit requirements.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@RequireRunOnProfileAnnotation(value = "android.os.usertype.profile.MANAGED", hasProfileOwner = true)
+@RequireRunOnProfileAnnotation(value = "android.os.usertype.profile.MANAGED",
+        hasProfileOwner = true)
 @EnsureHasProfileOwner
 @RequireFeature(FEATURE_DEVICE_ADMIN)
 public @interface RequireRunOnWorkProfile {
     OptionalBoolean installInstrumentedAppInParent() default ANY;
 
     /**
-     * Whether the profile owner's DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether the profile owner's DPC should be returned by calls to {@code Devicestate#dpc()}.
      *
      * <p>Only one device policy controller per test should be marked as primary.
      */
@@ -80,4 +79,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default EARLY;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
index 8a272e9..75cbed0 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
@@ -18,8 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -29,7 +27,7 @@
  * Mark that a test method should only run on specified sdk versions.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device with the
- * given version. Otherwise, you can use {@link DeviceState} to ensure that the test is
+ * given version. Otherwise, you can use {@code Devicestate} to ensure that the test is
  * not run when the sdk version is not correct.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java
index b718437..81bd147 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireTargetSdkVersion.java
@@ -18,8 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -29,7 +27,7 @@
  * Mark that a test method should only run in an apk targeting the specified sdk version.
  *
  * <p>Your test configuration may be configured so that this test is only run in an apk with the
- * given version. Otherwise, you can use {@link DeviceState} to ensure that the test is
+ * given version. Otherwise, you can use {@code Devicestate} to ensure that the test is
  * not run when the target sdk version is not correct.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
similarity index 92%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
index 325447c..e792d76 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
@@ -18,8 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 
-import com.android.bedstead.harrier.DeviceState;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Repeatable;
 import java.lang.annotation.Retention;
@@ -30,7 +28,7 @@
  * Mark that a test method should only run if a particular user type is supported
  *
  * <p>Your test configuration may be configured so that this test is only run on a user which
- * supports the user types. Otherwise, you can use {@link DeviceState} to ensure that the test is
+ * supports the user types. Otherwise, you can use {@code Devicestate} to ensure that the test is
  * not run when the user type is not supported.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequiresNonGrantablePermission.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequiresNonGrantablePermission.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequiresNonGrantablePermission.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/RequiresNonGrantablePermission.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/StringTestParameter.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/StringTestParameter.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/StringTestParameter.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/StringTestParameter.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
similarity index 90%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
index c581561..89b4c8f 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
@@ -18,7 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner.DO_PO_WEIGHT;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 
 import java.lang.annotation.ElementType;
@@ -29,8 +28,8 @@
 /**
  * Mark that a test requires that the given admin delegates the given scope to a test app.
  *
- * <p>You should use {@link DeviceState} to ensure that the device enters
- * the correct state for the method. You can use {@link DeviceState#delegate()} to interact with
+ * <p>You should use {@code Devicestate} to ensure that the device enters
+ * the correct state for the method. You can use {@code Devicestate#delegate()} to interact with
  * the delegate.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -57,7 +56,7 @@
     String[] scopes();
 
     /**
-     * Whether this delegate should be returned by calls to {@link DeviceState#policyManager()}.
+     * Whether this delegate should be returned by calls to {@code Devicestate#policyManager()}.
      *
      * <p>Only one policy manager per test should be marked as primary.
      */
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
similarity index 83%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
index 2fdfc9d..2626900c 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
@@ -16,11 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
-
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+import static com.android.bedstead.nene.packages.CommonPackages.FEATURE_DEVICE_ADMIN;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.FailureMode;
 import com.android.bedstead.harrier.annotations.RequireFeature;
@@ -34,15 +32,15 @@
  * Mark that a test requires that a device owner is available on the device.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device which has
- * a device owner. Otherwise, you can use {@link DeviceState} to ensure that the device enters
- * the correct state for the method. If using {@link DeviceState}, you can use
- * {@link DeviceState#deviceOwner()} to interact with the device owner.
+ * a device owner. Otherwise, you can use {@code Devicestate} to ensure that the device enters
+ * the correct state for the method. If using {@code Devicestate}, you can use
+ * {@code Devicestate#deviceOwner()} to interact with the device owner.
  *
- * <p>When running on a device with a headless system user, enforcing this with {@link DeviceState}
+ * <p>When running on a device with a headless system user, enforcing this with {@code Devicestate}
  * will also result in the profile owner of the current user being set to the same device policy
  * controller.
  *
- * <p>If {@link DeviceState} is required to set the device owner (because there isn't one already)
+ * <p>If {@code Devicestate} is required to set the device owner (because there isn't one already)
  * then all users and accounts may be removed from the device.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@@ -56,8 +54,8 @@
     FailureMode failureMode() default FailureMode.FAIL;
 
     /**
-     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()} or
-     * {@link DeviceState#policyManager()}}.
+     * Whether this DPC should be returned by calls to {@code Devicestate#dpc()} or
+     * {@code Devicestate#policyManager()}}.
      *
      * <p>Only one policy manager per test should be marked as primary.
      */
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
similarity index 95%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
index c0516f3..224d89a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
@@ -18,7 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate.ENSURE_HAS_DELEGATE_WEIGHT;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 
 import java.lang.annotation.ElementType;
@@ -29,7 +28,7 @@
 /**
  * Mark that a test requires that the given admin does not delegate the given scope to a test app.
  *
- * <p>You should use {@link DeviceState} to ensure that the device enters
+ * <p>You should use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
index 307b554..d7f1598 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
@@ -18,7 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner.DO_PO_WEIGHT;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 
 import java.lang.annotation.ElementType;
@@ -30,7 +29,7 @@
  * Mark that a test requires that there is no device owner on the device.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device which has
- * no device owner. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * no device owner. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
similarity index 94%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
index c97fd7f..c222c75 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
@@ -18,7 +18,6 @@
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner.DO_PO_WEIGHT;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
 
@@ -34,7 +33,7 @@
  * current user has no profile owner.
  *
  * <p>Your test configuration may be configured so that this test is only run on a device which has
- * no dpc. Otherwise, you can use {@link DeviceState} to ensure that the device enters
+ * no dpc. Otherwise, you can use {@code Devicestate} to ensure that the device enters
  * the correct state for the method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
index 561da3c..e4e964b 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner.DO_PO_WEIGHT;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 
 import java.lang.annotation.ElementType;
@@ -30,14 +30,14 @@
 /**
  * Mark that a test requires that there is no profile owner on the given user.
  *
- * <p>You can use {@link DeviceState} to ensure that the device enters the correct state for the
+ * <p>You can use {@code Devicestate} to ensure that the device enters the correct state for the
  * method.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface EnsureHasNoProfileOwner {
     /** Which user type the profile owner should not be attached to. */
-    DeviceState.UserType onUser() default CURRENT_USER;
+    UserType onUser() default CURRENT_USER;
 
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
similarity index 77%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
index b5da4dd..4950290 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
@@ -16,15 +16,11 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
-
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner.DO_PO_WEIGHT;
+import static com.android.bedstead.nene.packages.CommonPackages.FEATURE_DEVICE_ADMIN;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireFeature;
 
@@ -36,27 +32,27 @@
 /**
  * Mark that a test requires that a profile owner is set.
  *
- * <p>You can use {@link DeviceState} to ensure that the device enters
- * the correct state for the method. If using {@link DeviceState}, you can use
- * {@link DeviceState#profileOwner()} to interact with the profile owner.
+ * <p>You can use {@code Devicestate} to ensure that the device enters
+ * the correct state for the method. If using {@code Devicestate}, you can use
+ * {@code Devicestate#profileOwner()} to interact with the profile owner.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @RequireFeature(FEATURE_DEVICE_ADMIN)
 public @interface EnsureHasProfileOwner {
     /** Which user type the work profile should be attached to. */
-    DeviceState.UserType onUser() default CURRENT_USER;
+    UserType onUser() default CURRENT_USER;
 
     /**
-     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()} or
-     * {@link DeviceState#policyManager()}}.
+     * Whether this DPC should be returned by calls to {@code Devicestate#dpc()} or
+     * {@code Devicestate#policyManager()}}.
      *
      * <p>Only one policy manager per test should be marked as primary.
      */
     boolean isPrimary() default false;
 
     /**
-     * If true, uses the {@link DevicePolicyManager#getParentProfileInstance(ComponentName)}
+     * If true, uses the {@code DevicePolicyManager#getParentProfileInstance(ComponentName)}
      * instance of the dpc when calling to .dpc()
      *
      * <p>Only used if {@link #isPrimary()} is true.
@@ -79,4 +75,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default DO_PO_WEIGHT;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java
similarity index 83%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java
index fdd78f0..75f610d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfile.java
@@ -16,9 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.meta;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.Target;
 
@@ -28,5 +28,5 @@
  */
 @Target({})
 public @interface EnsureHasNoProfile {
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfileAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfileAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfileAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoProfileAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUserAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUserAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUserAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasNoUserAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
index b9b3e08..31740ca 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
@@ -16,11 +16,11 @@
 
 package com.android.bedstead.harrier.annotations.meta;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
 import static com.android.bedstead.harrier.OptionalBoolean.ANY;
+import static com.android.bedstead.harrier.UserType.CURRENT_USER;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
+import com.android.bedstead.harrier.UserType;
 
 import java.lang.annotation.Target;
 
@@ -31,13 +31,13 @@
 @Target({})
 public @interface EnsureHasProfile {
     /** Which user type the profile should be attached to. */
-    DeviceState.UserType forUser() default CURRENT_USER;
+    UserType forUser() default CURRENT_USER;
 
     /** Whether the test app should be installed in the profile. */
     boolean installTestApp() default true;
 
     /**
-     * Whether the profile owner's DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether the profile owner's DPC should be returned by calls to {@code Devicestate#dpc()}.
      *
      * <p>Only one device policy controller per test should be marked as primary.
      */
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfileAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfileAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfileAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfileAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUserAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUserAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUserAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUserAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/ParameterizedAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/ParameterizedAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/ParameterizedAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/ParameterizedAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RepeatingAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RepeatingAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RepeatingAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RepeatingAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
similarity index 95%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
index 6bc4087..ce10411 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
@@ -19,7 +19,6 @@
 import static com.android.bedstead.harrier.OptionalBoolean.ANY;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
 
-import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
 
 import java.lang.annotation.Target;
@@ -33,7 +32,7 @@
     OptionalBoolean installInstrumentedAppInParent() default ANY;
 
     /**
-     * Whether the profile owner's DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether the profile owner's DPC should be returned by calls to {@code Devicestate#dpc()}.
      *
      * <p>Only one device policy controller per test should be marked as primary.
      */
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfileAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfileAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfileAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfileAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequiresBedsteadJUnit4.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequiresBedsteadJUnit4.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequiresBedsteadJUnit4.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/meta/RequiresBedsteadJUnit4.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerUsingParentInstance.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerUsingParentInstance.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerUsingParentInstance.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerUsingParentInstance.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
similarity index 99%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
index 17b5240..96c73ab 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
@@ -51,4 +51,4 @@
      * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
      */
     int weight() default LATE;
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
similarity index 93%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
index 303e123..a243839 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
@@ -18,7 +18,7 @@
 
 import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
-import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.UserType;
 import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
@@ -37,7 +37,7 @@
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
-@EnsureHasWorkProfile(forUser = DeviceState.UserType.PRIMARY_USER, dpcIsPrimary = true)
+@EnsureHasWorkProfile(forUser = UserType.PRIMARY_USER, dpcIsPrimary = true)
 public @interface IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile {
     /**
      * Weight sets the order that annotations will be resolved.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
index 375ef7c..833fdc9 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
@@ -20,17 +20,14 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for account management tests.
  *
- * <p>This is used by {@link
+ * <p>This is used by {@code
  * DevicePolicyManager#setAccountManagementDisabled(ComponentName, String, boolean)} and
- * {@link DevicePolicyManager#getAccountTypesWithManagementDisabled()}.
+ * {@code DevicePolicyManager#getAccountTypesWithManagementDisabled()}.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER)
 public final class AccountManagement {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
similarity index 84%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
index 9e30dad..19b7f78 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
@@ -16,17 +16,12 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
-
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_IN_BACKGROUND;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.CAN_BE_DELEGATED;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.os.Bundle;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_APP_RESTRICTIONS;
 
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
@@ -34,8 +29,8 @@
  * Policy for application restrictions.
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#setApplicationRestrictions(ComponentName, String, Bundle)} and
- * {@link DevicePolicyManager#getApplicationRestrictions(ComponentName, String)}.
+ * {@code DevicePolicyManager#setApplicationRestrictions(ComponentName, String, Bundle)} and
+ * {@code DevicePolicyManager#getApplicationRestrictions(ComponentName, String)}.
  */
 @EnterprisePolicy(
         dpc = {
@@ -44,4 +39,4 @@
         delegatedScopes = DELEGATION_APP_RESTRICTIONS
         )
 public final class ApplicationRestrictions {
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
index 379b071..b41ac24 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
@@ -21,17 +21,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_IN_BACKGROUND;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.os.Bundle;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for application restrictions.
  *
  * <p>This is used by the method
- * {@link DevicePolicyManager#setApplicationRestrictionsManagingPackage(ComponentName, String, Bundle)}
+ * {@code DevicePolicyManager#setApplicationRestrictionsManagingPackage(ComponentName, String, Bundle)}
  */
 @EnterprisePolicy(
         dpc = {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
similarity index 86%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
index 4a6d384..1cd71e2 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
@@ -20,17 +20,14 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policies around installing/uninstalling CaCerts
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#installCaCert(ComponentName, byte[])} and
- * {@link DevicePolicyManager#uninstallCaCert(ComponentName, byte[])}.
+ * {@code DevicePolicyManager#installCaCert(ComponentName, byte[])} and
+ * {@code DevicePolicyManager#uninstallCaCert(ComponentName, byte[])}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
 public final class CaCertManagement {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
index 4309473..5e2eeff 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
@@ -22,17 +22,14 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_GLOBALLY;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for application restrictions.
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#setCameraDisabled(ComponentName, boolean)} and
- * {@link DevicePolicyManager#getCameraDisabled(ComponentName)}.
+ * {@code DevicePolicyManager#setCameraDisabled(ComponentName, boolean)} and
+ * {@code DevicePolicyManager#getCameraDisabled(ComponentName)}.
  */
 // TODO(b/201753989):  Update the profileOwner flag once the behaviour of setCameraDisabled
 //  is properly defined on secondary user POs.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
similarity index 86%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
index c1c62c1..098a20d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
@@ -19,16 +19,12 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.os.PersistableBundle;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for create and manage user.
  *
- * <p>This is used by methods such as {@link DevicePolicyManager#createAndManageUser(
+ * <p>This is used by methods such as {@code DevicePolicyManager#createAndManageUser(
  * ComponentName, String, ComponentName, PersistableBundle, int)}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
similarity index 81%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
index c7d8f80..2f1494f 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
@@ -17,18 +17,14 @@
 package com.android.bedstead.harrier.policies;
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for set default SMS application test.
  *
- * <p>This is used by {@link DevicePolicyManager#setDefaultSmsApplication(ComponentName, String)}.
+ * <p>This is used by {@code DevicePolicyManager#setDefaultSmsApplication(ComponentName, String)}.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER)
 public final class DefaultSmsApplication {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/Delegation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
similarity index 90%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
index 5bcde92..4512f48 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
@@ -20,18 +20,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
-import java.util.List;
-
 /**
  * Policy for general admin delegation that doesn't have additional scope-specific constraints on
  * the admin type. Specific delegations with these constraints have their own policies.
  *
- * <p>This is used for methods such as {@link
+ * <p>This is used for methods such as {@code
  * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java
similarity index 91%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java
index f6a7b47..a3fc08a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DeprecatedResetPassword.java
@@ -20,12 +20,10 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
- * Policy for {@link DevicePolicyManager#resetPassword(String, int)}.
+ * Policy for {@code DevicePolicyManager#resetPassword(String, int)}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
 public final class DeprecatedResetPassword {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
similarity index 100%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
similarity index 92%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
index 2311c5e..c054f49 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
@@ -20,13 +20,11 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for testing enrollment specific ID.
- * See {@link DevicePolicyManager#getEnrollmentSpecificId()} for more detail.
+ * See {@code DevicePolicyManager#getEnrollmentSpecificId()} for more detail.
  */
 @EnterprisePolicy(dpc = {
         APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER,
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
similarity index 82%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
copy to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
index 82a30a8..ef9fb68 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
@@ -20,18 +20,16 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
- * Policies around resetting a new device password
+ * Policies around key management
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#resetPasswordWithToken(ComponentName, String, byte[], int)}
+ * {@code DevicePolicyManager#installKeyPair(ComponentName, PrivateKey, Certificate, String)} and
+ * {@code DevicePolicyManager#removeKeyPair(ComponentName, String)}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
         APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
-public class ResetPasswordWithToken {
+public final class KeyManagement {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockNow.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockNow.java
similarity index 90%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockNow.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockNow.java
index 8f9da73..823cf8e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockNow.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockNow.java
@@ -16,18 +16,15 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static android.Manifest.permission.LOCK_DEVICE;
-
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
-
-import android.app.admin.DevicePolicyManager;
+import static com.android.bedstead.nene.permissions.CommonPermissions.LOCK_DEVICE;
 
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
- * Policy for {@link DevicePolicyManager#lockNow()}
+ * Policy for {@code DevicePolicyManager#lockNow()}.
  */
 // This is not applied by profile owner as the behaviour is different with a unified challenge
 @EnterprisePolicy(dpc =
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
index a4e8124..057824c 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
@@ -21,9 +21,6 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
@@ -31,10 +28,10 @@
  * (https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode).
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#setLockTaskFeatures(ComponentName, int)} and
- * {@link DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}.
+ * {@code DevicePolicyManager#setLockTaskFeatures(ComponentName, int)} and
+ * {@code DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}.
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
                     APPLIED_BY_AFFILIATED_PROFILE_OWNER | APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO | APPLIES_TO_OWN_USER})
 public final class LockTask {
-}
\ No newline at end of file
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
similarity index 88%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
index ae4dfcd..8b5b2bd 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
@@ -20,18 +20,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER_PROFILE;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
-import java.util.List;
-
 /**
  * Policy for network logging delegation.
  *
- * <p>This is used for methods such as {@link
- * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)} with scope {@link
+ * <p>This is used for methods such as {@code
+ * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)} with scope {@code
  * DevicePolicyManager#DELEGATION_NETWORK_LOGGING}.
  */
 @EnterprisePolicy(dpc = {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
similarity index 91%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
index 45185a9..82603be 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
@@ -19,13 +19,11 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER_PROFILE;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for testing preferential network service.
- * See {@link DevicePolicyManager#setPreferentialNetworkServiceEnabled(boolean)} for more detail.
+ * See {@code DevicePolicyManager#setPreferentialNetworkServiceEnabled(boolean)} for more detail.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER)
 public final class PreferentialNetworkService {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
index 82a30a8..0d1a832 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
@@ -20,16 +20,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policies around resetting a new device password
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#resetPasswordWithToken(ComponentName, String, byte[], int)}
+ * {@code DevicePolicyManager#resetPasswordWithToken(ComponentName, String, byte[], int)}
  */
 @EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
         APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
similarity index 90%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
index a895cfb..8cdb1b0 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
@@ -21,16 +21,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for disabling screen capture.
  *
  * <p>Users of this policy are
- * {@link DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}.
+ * {@code DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER
         | APPLIED_BY_PARENT_INSTANCE_OF_COPE_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER)
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
similarity index 87%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
index b8f7617..7dfcf6f 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
@@ -19,18 +19,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
-import java.util.List;
-
 /**
  * Policy for security logging delegation.
  *
- * <p>This is used for methods such as {@link
- * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)} with scope {@link
+ * <p>This is used for methods such as {@code
+ * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)} with scope {@code
  * DevicePolicyManager#DELEGATION_SECURITY_LOGGING}.
  */
 // TODO(b/198774281): COPE profile POs can call this too, but we need to add the flag.
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
similarity index 87%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
index bc3861a..7fe01ac 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
@@ -16,15 +16,11 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
-
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.CAN_BE_DELEGATED;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_PERMISSION_GRANT;
 
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
@@ -32,7 +28,7 @@
  * Policies around setting the grant state of a basic permission.
  *
  * <p>This is used by
- * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * {@code DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
  * granting permissions not covered by other policies.
  */
 @EnterprisePolicy(
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
similarity index 89%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
index 9e1e832..b69851e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
@@ -19,16 +19,13 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policies around setting the grant state of a sensor permission.
  *
  * <p>This is used by
- * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * {@code DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
  * granting sensor permissions.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER)
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
similarity index 87%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
index fac7dcd..b4d2a03 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
@@ -16,15 +16,12 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
 
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.CAN_BE_DELEGATED;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
+import static com.android.bedstead.nene.devicepolicy.CommonDevicePolicy.DELEGATION_PERMISSION_GRANT;
 
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
@@ -32,7 +29,7 @@
  * Policies around setting the grant state of a SMS related permission.
  *
  * <p>This is used by
- * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * {@code DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
  * granting sms-related permissions.
  */
 // TODO(198311372): Check if APPLIED_BY_PROFILE_OWNER_USER is expected
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
similarity index 82%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
index b963290..7f16f55 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
@@ -20,17 +20,14 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /**
  * Policy for long and short support messages.
  *
- * <p>Users of this policy are {@link DevicePolicyManager#setLongSupportMessage(ComponentName,
- * CharSequence)}, {@link DevicePolicyManager#setShortSupportMessage(ComponentName, CharSequence)},
- * {@link DevicePolicyManager#getLongSupportMessage(ComponentName)} and {@link
+ * <p>Users of this policy are {@code DevicePolicyManager#setLongSupportMessage(ComponentName,
+ * CharSequence)}, {@code DevicePolicyManager#setShortSupportMessage(ComponentName, CharSequence)},
+ * {@code DevicePolicyManager#getLongSupportMessage(ComponentName)} and {@code
  * DevicePolicyManager#getShortSupportMessage(ComponentName)}.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER)
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
similarity index 83%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
rename to common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
index 2adaf92..c47db87 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
+++ b/common/device-side/bedstead/harrier/common/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
@@ -19,19 +19,14 @@
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
 import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_GLOBALLY;
 
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
-import java.util.List;
-
 /**
  * Policy for user control disabled packages.
  *
  * <p>This is used by methods such as
- * {@link DevicePolicyManager#setUserControlDisabledPackages(ComponentName, List)} and
- * {@link DevicePolicyManager#getUserControlDisabledPackages(ComponentName)}.
+ * {@code DevicePolicyManager#setUserControlDisabledPackages(ComponentName, List)} and
+ * {@code DevicePolicyManager#getUserControlDisabledPackages(ComponentName)}.
  */
 @EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_GLOBALLY)
 public final class UserControlDisabledPackages {
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DeviceState.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DeviceState.java
index c7857b8..5746d75 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DeviceState.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DeviceState.java
@@ -20,6 +20,7 @@
 import static android.app.ActivityManager.STOP_USER_ON_SWITCH_DEFAULT;
 import static android.app.ActivityManager.STOP_USER_ON_SWITCH_FALSE;
 
+import static com.android.bedstead.harrier.Defaults.DEFAULT_PASSWORD;
 import static com.android.bedstead.nene.users.UserType.MANAGED_PROFILE_TYPE_NAME;
 import static com.android.bedstead.nene.users.UserType.SECONDARY_USER_TYPE_NAME;
 import static com.android.bedstead.nene.utils.Versions.meetsSdkVersionRequirements;
@@ -104,7 +105,6 @@
 import junit.framework.AssertionFailedError;
 
 import org.junit.AssumptionViolatedException;
-import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
@@ -138,7 +138,7 @@
  *
  * {@code assumeTrue} will be used, so tests which do not meet preconditions will be skipped.
  */
-public final class DeviceState implements TestRule {
+public final class DeviceState extends HarrierRule {
 
     private static final ComponentName REMOTE_DPC_COMPONENT_NAME = RemoteDpc.DPC_COMPONENT_NAME;
 
@@ -177,13 +177,6 @@
 
     private static final String TV_PROFILE_TYPE_NAME = "com.android.tv.profile";
 
-    /**
-     * The password to be used in tests.
-     *
-     * The infrastructure will use this password when a password exists and is required.
-     */
-    public static final String DEFAULT_PASSWORD = "1234";
-
     public DeviceState() {
         Bundle arguments = InstrumentationRegistry.getArguments();
         mSkipTestTeardown = Boolean.parseBoolean(
@@ -202,10 +195,12 @@
         }
     }
 
+    @Override
     void setSkipTestTeardown(boolean skipTestTeardown) {
         mSkipTestTeardown = skipTestTeardown;
     }
 
+    @Override
     void setUsingBedsteadJUnit4(boolean usingBedsteadJUnit4) {
         mUsingBedsteadJUnit4 = usingBedsteadJUnit4;
     }
@@ -948,17 +943,6 @@
         }
     }
 
-    public enum UserType {
-        /** Only to be used with annotations. */
-        ANY,
-        SYSTEM_USER,
-        CURRENT_USER,
-        PRIMARY_USER,
-        SECONDARY_USER,
-        WORK_PROFILE,
-        TV_PROFILE,
-    }
-
     private static final String LOG_TAG = "DeviceState";
 
     private static final Context sContext = TestApis.context().instrumentedContext();
@@ -1410,7 +1394,9 @@
                     mDeviceOwner.remove();
                 }
             } else if (!mOriginalDeviceOwner.equals(mDeviceOwner)) {
-                mDeviceOwner.remove();
+                if (mDeviceOwner != null) {
+                    mDeviceOwner.remove();
+                }
                 TestApis.devicePolicy().setDeviceOwner(
                         mOriginalDeviceOwner.componentName());
             }
@@ -2042,7 +2028,8 @@
 
         try {
             user.clearPassword(DEFAULT_PASSWORD);
-        } catch (NeneException e) {
+        } catch (NeneException e
+        ) {
             throw new AssertionError(
                     "Test requires user " + user + " does not have a password. "
                             + "Password is set and is not DEFAULT_PASSWORD.");
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
deleted file mode 100644
index 9d409e6..0000000
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.bedstead.harrier.policies;
-
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_DEVICE_OWNER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_PROFILE_OWNER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-
-import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
-
-import java.security.PrivateKey;
-import java.security.cert.Certificate;
-
-/**
- * Policies around key management
- *
- * <p>This is used by methods such as
- * {@link DevicePolicyManager#installKeyPair(ComponentName, PrivateKey, Certificate, String)} and
- * {@link DevicePolicyManager#removeKeyPair(ComponentName, String)}.
- */
-@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
-        APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
-public final class KeyManagement {
-}
\ No newline at end of file
diff --git a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateTest.java b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateTest.java
index c5687a7..a82f7db 100644
--- a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateTest.java
+++ b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateTest.java
@@ -23,10 +23,10 @@
 import static android.content.pm.PackageManager.PERMISSION_DENIED;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.ANY;
-import static com.android.bedstead.harrier.DeviceState.UserType.PRIMARY_USER;
 import static com.android.bedstead.harrier.OptionalBoolean.FALSE;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+import static com.android.bedstead.harrier.UserType.ANY;
+import static com.android.bedstead.harrier.UserType.PRIMARY_USER;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GMS_CORE_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireCnGmsBuild.CHINA_GOOGLE_SERVICES_FEATURE;
 import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate.AdminType.DEVICE_OWNER;
@@ -368,14 +368,14 @@
     }
 
     @EnsureHasSecondaryUser
-    @EnsureHasProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
+    @EnsureHasProfileOwner(onUser = UserType.SECONDARY_USER)
     public void ensureHasProfileOwnerAnnotation_otherUser_setsProfileOwner() {
         assertThat(TestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser()))
                 .isNotNull();
     }
 
     @EnsureHasSecondaryUser
-    @EnsureHasNoProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
+    @EnsureHasNoProfileOwner(onUser = UserType.SECONDARY_USER)
     public void ensureHasNoProfileOwnerAnnotation_otherUser_profileOwnerIsNotSet() {
         assertThat(TestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser())).isNull();
     }
@@ -394,14 +394,14 @@
     }
 
     @EnsureHasSecondaryUser
-    @EnsureHasProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
+    @EnsureHasProfileOwner(onUser = UserType.SECONDARY_USER)
     public void profileOwner_otherUser_profileOwnerIsSet_returnsProfileOwner() {
         assertThat(sDeviceState.profileOwner(sDeviceState.secondaryUser())).isNotNull();
     }
 
     @Test
     @EnsureHasSecondaryUser
-    @EnsureHasNoProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
+    @EnsureHasNoProfileOwner(onUser = UserType.SECONDARY_USER)
     public void profileOwner_otherUser_profileOwnerIsNotSet_throwsException() {
         assertThrows(IllegalStateException.class, sDeviceState::profileOwner);
     }
@@ -409,7 +409,7 @@
     @Test
     public void profileOwner_userType_onUserIsNull_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> sDeviceState.profileOwner((DeviceState.UserType) null));
+                () -> sDeviceState.profileOwner((UserType) null));
     }
 
     @Test
diff --git a/common/device-side/bedstead/nene/Android.bp b/common/device-side/bedstead/nene/Android.bp
index 21809bb..7ca45b7 100644
--- a/common/device-side/bedstead/nene/Android.bp
+++ b/common/device-side/bedstead/nene/Android.bp
@@ -2,6 +2,22 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
+java_library_host {
+    name: "NeneCommon",
+    srcs: [
+        "common/src/main/java/**/*.java"
+    ],
+}
+
+android_library {
+    name: "NeneCommonAndroid",
+    srcs: [
+        "common/src/main/java/**/*.java"
+    ],
+    manifest: "src/main/AndroidManifestInternal.xml",
+    min_sdk_version: "27"
+}
+
 // TODO(b/203507664): Remove NeneInternal once we no longer need QUERY_ALL_PACKAGES to install
 android_library {
     name: "NeneInternal",
@@ -14,6 +30,7 @@
         "compatibility-device-util-axt",
         "guava",
         "Queryable",
+        "NeneCommonAndroid",
         "RemoteFrameworkClasses"
     ],
     min_sdk_version: "27"
@@ -30,6 +47,7 @@
         "compatibility-device-util-axt",
         "guava",
         "Queryable",
+        "NeneCommonAndroid",
         "RemoteFrameworkClasses"
     ],
     min_sdk_version: "27"
diff --git a/common/device-side/bedstead/nene/common/AndroidManifest.xml b/common/device-side/bedstead/nene/common/AndroidManifest.xml
new file mode 100644
index 0000000..3ba12e1
--- /dev/null
+++ b/common/device-side/bedstead/nene/common/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  ~ Copyright (C) 2021 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.
+  -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.android.bedstead.nene.common">
+    <uses-sdk android:minSdkVersion="27" />
+    <application>
+    </application>
+</manifest>
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/annotations/Nullable.java
similarity index 63%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
copy to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/annotations/Nullable.java
index 257cc2f..fb3ce77 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
+++ b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/annotations/Nullable.java
@@ -14,9 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.harrier.annotations;
-
-import com.android.bedstead.harrier.DeviceState;
+package com.android.bedstead.nene.annotations;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -24,13 +22,11 @@
 import java.lang.annotation.Target;
 
 /**
- * Annotation to indicate that a test requires a low ram device.
+ * Marks a value may be Null.
  *
- * <p>This can be enforced by using {@link DeviceState}.
+ * <p>This can be used on host or device side code.
  */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface RequireLowRamDevice {
-    String reason();
-    FailureMode failureMode() default FailureMode.SKIP;
+@Target({ElementType.LOCAL_VARIABLE, ElementType.FIELD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.SOURCE)
+public @interface Nullable {
 }
diff --git a/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/devicepolicy/CommonDevicePolicy.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/devicepolicy/CommonDevicePolicy.java
new file mode 100644
index 0000000..5927775
--- /dev/null
+++ b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/devicepolicy/CommonDevicePolicy.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.nene.devicepolicy;
+
+/** Device Policy helper methods common to host and device. */
+public class CommonDevicePolicy {
+    CommonDevicePolicy() {
+
+    }
+
+    /** See {@code DevicePolicyManager#DELEGATION_CERT_INSTALL}. */
+    public static final String DELEGATION_CERT_INSTALL = "delegation-cert-install";
+
+    /** See {@code DevicePolicyManager#DELEGATION_APP_RESTRICTIONS}. */
+    public static final String DELEGATION_APP_RESTRICTIONS = "delegation-app-restrictions";
+
+    /** See {@code DevicePolicyManager#DELEGATION_BLOCK_UNINSTALL}. */
+    public static final String DELEGATION_BLOCK_UNINSTALL = "delegation-block-uninstall";
+
+    /** See {@code DevicePolicyManager#DELEGATION_PERMISSION_GRANT}. */
+    public static final String DELEGATION_PERMISSION_GRANT = "delegation-permission-grant";
+
+    /** See {@code DevicePolicyManager#DELEGATION_PACKAGE_ACCESS}. */
+    public static final String DELEGATION_PACKAGE_ACCESS = "delegation-package-access";
+
+    /** See {@code DevicePolicyManager#DELEGATION_ENABLE_SYSTEM_APP}. */
+    public static final String DELEGATION_ENABLE_SYSTEM_APP = "delegation-enable-system-app";
+
+    /** See {@code DevicePolicyManager#DELEGATION_INSTALL_EXISTING_PACKAGE}. */
+    public static final String DELEGATION_INSTALL_EXISTING_PACKAGE =
+            "delegation-install-existing-package";
+
+    /** See {@code DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES}. */
+    public static final String DELEGATION_KEEP_UNINSTALLED_PACKAGES =
+            "delegation-keep-uninstalled-packages";
+
+    /** See {@code DevicePolicyManager#DELEGATION_NETWORK_LOGGING}. */
+    public static final String DELEGATION_NETWORK_LOGGING = "delegation-network-logging";
+
+    /** See {@code DevicePolicyManager#DELEGATION_CERT_SELECTION}. */
+    public static final String DELEGATION_CERT_SELECTION = "delegation-cert-selection";
+
+    /** See {@code DevicePolicyManager#DELEGATION_SECURITY_LOGGING}. */
+    public static final String DELEGATION_SECURITY_LOGGING = "delegation-security-logging";
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java
similarity index 97%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java
rename to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java
index ca3ef6d..a3845f9 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java
+++ b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/AdbException.java
@@ -16,7 +16,7 @@
 
 package com.android.bedstead.nene.exceptions;
 
-import androidx.annotation.Nullable;
+import com.android.bedstead.nene.annotations.Nullable;
 
 /**
  * An exception that gets thrown when interacting with Adb.
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/AdbParseException.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/AdbParseException.java
similarity index 100%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/AdbParseException.java
rename to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/AdbParseException.java
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
similarity index 100%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
rename to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
similarity index 100%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
rename to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
diff --git a/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/packages/CommonPackages.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/packages/CommonPackages.java
new file mode 100644
index 0000000..6a6f622
--- /dev/null
+++ b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/packages/CommonPackages.java
@@ -0,0 +1,505 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.nene.packages;
+
+/** Packages helper methods common to host and device. */
+public class CommonPackages {
+    CommonPackages() {}
+
+    /** See {@code PackageManager#FEATURE_AUDIO_LOW_LATENCY}. */
+    public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
+
+    /** See {@code PackageManager#FEATURE_AUDIO_OUTPUT}. */
+    public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
+
+    /** See {@code PackageManager#FEATURE_AUDIO_PRO}. */
+    public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
+
+    /** See {@code PackageManager#FEATURE_BLUETOOTH}. */
+    public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
+
+    /** See {@code PackageManager#FEATURE_BLUETOOTH_LE}. */
+    public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
+
+    /** See {@code PackageManager#FEATURE_CAMERA}. */
+    public static final String FEATURE_CAMERA = "android.hardware.camera";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_AUTOFOCUS}. */
+    public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_ANY}. */
+    public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_EXTERNAL}. */
+    public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_FLASH}. */
+    public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_FRONT}. */
+    public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_LEVEL_FULL}. */
+    public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR}. */
+    public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
+            "android.hardware.camera.capability.manual_sensor";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING}. */
+    public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
+            "android.hardware.camera.capability.manual_post_processing";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_CAPABILITY_RAW}. */
+    public static final String FEATURE_CAMERA_CAPABILITY_RAW =
+            "android.hardware.camera.capability.raw";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_AR}. */
+    public static final String FEATURE_CAMERA_AR =
+            "android.hardware.camera.ar";
+
+    /** See {@code PackageManager#FEATURE_CAMERA_CONCURRENT}. */
+    public static final String FEATURE_CAMERA_CONCURRENT = "android.hardware.camera.concurrent";
+
+    /** See {@code PackageManager#FEATURE_CONSUMER_IR}. */
+    public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
+
+    /** See {@code PackageManager#FEATURE_CONTEXT_HUB}. */
+    public static final String FEATURE_CONTEXT_HUB = "android.hardware.context_hub";
+
+    /** See {@code PackageManager#FEATURE_CTS}. */
+    public static final String FEATURE_CTS = "android.software.cts";
+
+    /** See {@code PackageManager#FEATURE_CAR_TEMPLATES_HOST}. */
+    public static final String FEATURE_CAR_TEMPLATES_HOST =
+            "android.software.car.templates_host";
+
+    /** See {@code PackageManager#FEATURE_IDENTITY_CREDENTIAL_HARDWARE}. */
+    public static final String FEATURE_IDENTITY_CREDENTIAL_HARDWARE =
+            "android.hardware.identity_credential";
+
+    /** See {@code PackageManager#FEATURE_IDENTITY_CREDENTIAL_HARDWARE_DIRECT_ACCESS}. */
+    public static final String FEATURE_IDENTITY_CREDENTIAL_HARDWARE_DIRECT_ACCESS =
+            "android.hardware.identity_credential_direct_access";
+
+    /** See {@code PackageManager#FEATURE_LOCATION}. */
+    public static final String FEATURE_LOCATION = "android.hardware.location";
+
+    /** See {@code PackageManager#FEATURE_LOCATION_GPS}. */
+    public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
+
+    /** See {@code PackageManager#FEATURE_LOCATION_NETWORK}. */
+    public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
+
+    /** See {@code PackageManager#FEATURE_FELICA}. */
+    public static final String FEATURE_FELICA = "android.hardware.felica";
+
+    /** See {@code PackageManager#FEATURE_RAM_LOW}. */
+    public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
+
+    /** See {@code PackageManager#FEATURE_RAM_NORMAL}. */
+    public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
+
+    /** See {@code PackageManager#FEATURE_MICROPHONE}. */
+    public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
+
+    /** See {@code PackageManager#FEATURE_NFC}. */
+    public static final String FEATURE_NFC = "android.hardware.nfc";
+
+    /** See {@code PackageManager#FEATURE_NFC_HCE}. */
+    public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
+
+    /** See {@code PackageManager#FEATURE_NFC_HOST_CARD_EMULATION}. */
+    public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
+
+    /** See {@code PackageManager#FEATURE_NFC_HOST_CARD_EMULATION_NFCF}. */
+    public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
+
+    /** See {@code PackageManager#FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC}. */
+    public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC =
+            "android.hardware.nfc.uicc";
+
+    /** See {@code PackageManager#FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE}. */
+    public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
+
+    /** See {@code PackageManager#FEATURE_NFC_BEAM}. */
+    public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam";
+
+    /** See {@code PackageManager#FEATURE_NFC_ANY}. */
+    public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
+
+    /** See {@code PackageManager#FEATURE_SE_OMAPI_UICC}. */
+    public static final String FEATURE_SE_OMAPI_UICC = "android.hardware.se.omapi.uicc";
+
+    /** See {@code PackageManager#FEATURE_SE_OMAPI_ESE}. */
+    public static final String FEATURE_SE_OMAPI_ESE = "android.hardware.se.omapi.ese";
+
+    /** See {@code PackageManager#FEATURE_SE_OMAPI_SD}. */
+    public static final String FEATURE_SE_OMAPI_SD = "android.hardware.se.omapi.sd";
+
+    /** See {@code PackageManager#FEATURE_SECURITY_MODEL_COMPATIBLE}. */
+    public static final String FEATURE_SECURITY_MODEL_COMPATIBLE =
+            "android.hardware.security.model.compatible";
+
+    /** See {@code PackageManager#FEATURE_OPENGLES_EXTENSION_PACK}. */
+    public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
+
+    /** See {@code PackageManager#FEATURE_VULKAN_HARDWARE_LEVEL}. */
+    public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
+
+    /** See {@code PackageManager#FEATURE_VULKAN_HARDWARE_COMPUTE}. */
+    public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
+
+    /** See {@code PackageManager#FEATURE_VULKAN_HARDWARE_VERSION}. */
+    public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
+
+    /** See {@code PackageManager#FEATURE_VULKAN_DEQP_LEVEL}. */
+    public static final String FEATURE_VULKAN_DEQP_LEVEL = "android.software.vulkan.deqp.level";
+
+    /** See {@code PackageManager#FEATURE_OPENGLES_DEQP_LEVEL}. */
+    public static final String FEATURE_OPENGLES_DEQP_LEVEL = "android.software.opengles.deqp.level";
+
+    /** See {@code PackageManager#FEATURE_BROADCAST_RADIO}. */
+    public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
+
+    /** See {@code PackageManager#FEATURE_SECURE_LOCK_SCREEN}. */
+    public static final String FEATURE_SECURE_LOCK_SCREEN = "android.software.secure_lock_screen";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_ACCELEROMETER}. */
+    public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_BAROMETER}. */
+    public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_COMPASS}. */
+    public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_GYROSCOPE}. */
+    public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_LIGHT}. */
+    public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_PROXIMITY}. */
+    public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_STEP_COUNTER}. */
+    public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_STEP_DETECTOR}. */
+    public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_HEART_RATE}. */
+    public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_HEART_RATE_ECG}. */
+    public static final String FEATURE_SENSOR_HEART_RATE_ECG =
+            "android.hardware.sensor.heartrate.ecg";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_RELATIVE_HUMIDITY}. */
+    public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
+            "android.hardware.sensor.relative_humidity";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_AMBIENT_TEMPERATURE}. */
+    public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
+            "android.hardware.sensor.ambient_temperature";
+
+    /** See {@code PackageManager#FEATURE_SENSOR_HINGE_ANGLE}. */
+    public static final String FEATURE_SENSOR_HINGE_ANGLE = "android.hardware.sensor.hinge_angle";
+
+    /** See {@code PackageManager#FEATURE_HIFI_SENSORS}. */
+    public static final String FEATURE_HIFI_SENSORS =
+            "android.hardware.sensor.hifi_sensors";
+
+    /** See {@code PackageManager#FEATURE_ASSIST_GESTURE}. */
+    public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY}. */
+    public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_CDMA}. */
+    public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_GSM}. */
+    public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. */
+    public static final String FEATURE_TELEPHONY_CARRIERLOCK =
+            "android.hardware.telephony.carrierlock";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_EUICC}. */
+    public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_MBMS}. */
+    public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_IMS}. */
+    public static final String FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
+
+    /** See {@code PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION}. */
+    public static final String FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION =
+            "android.hardware.telephony.ims.singlereg";
+
+    /** See {@code PackageManager#FEATURE_UWB}. */
+    public static final String FEATURE_UWB = "android.hardware.uwb";
+
+    /** See {@code PackageManager#FEATURE_USB_HOST}. */
+    public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
+
+    /** See {@code PackageManager#FEATURE_USB_ACCESSORY}. */
+    public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
+
+    /** See {@code PackageManager#FEATURE_SIP}. */
+    public static final String FEATURE_SIP = "android.software.sip";
+
+    /** See {@code PackageManager#FEATURE_SIP_VOIP}. */
+    public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
+
+    /** See {@code PackageManager#FEATURE_CONNECTION_SERVICE}. */
+    public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
+
+    /** See {@code PackageManager#FEATURE_TOUCHSCREEN}. */
+    public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
+
+    /** See {@code PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH}. */
+    public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
+
+    /** See {@code PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}. */
+    public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
+
+    /** See {@code PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}. */
+    public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
+
+    /** See {@code PackageManager#FEATURE_FAKETOUCH}. */
+    public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
+
+    /** See {@code PackageManager#FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. */
+    public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
+
+    /** See {@code PackageManager#FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND}. */
+    public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
+
+    /** See {@code PackageManager#FEATURE_FINGERPRINT}. */
+    public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
+
+    /** See {@code PackageManager#FEATURE_FACE}. */
+    public static final String FEATURE_FACE = "android.hardware.biometrics.face";
+
+    /** See {@code PackageManager#FEATURE_IRIS}. */
+    public static final String FEATURE_IRIS = "android.hardware.biometrics.iris";
+
+    /** See {@code PackageManager#FEATURE_SCREEN_PORTRAIT}. */
+    public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
+
+    /** See {@code PackageManager#FEATURE_SCREEN_LANDSCAPE}. */
+    public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
+
+    /** See {@code PackageManager#FEATURE_LIVE_WALLPAPER}. */
+    public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
+
+    /** See {@code PackageManager#FEATURE_APP_WIDGETS}. */
+    public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
+
+    /** See {@code PackageManager#FEATURE_CANT_SAVE_STATE}. */
+    public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
+
+    /** See {@code PackageManager#FEATURE_GAME_SERVICE}. */
+    public static final String FEATURE_GAME_SERVICE = "android.software.game_service";
+
+    /** See {@code PackageManager#FEATURE_VOICE_RECOGNIZERS}. */
+    public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
+
+    /** See {@code PackageManager#FEATURE_HOME_SCREEN}. */
+    public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
+
+    /** See {@code PackageManager#FEATURE_INPUT_METHODS}. */
+    public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
+
+    /** See {@code PackageManager#FEATURE_DEVICE_ADMIN}. */
+    public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
+
+    /** See {@code PackageManager#FEATURE_LEANBACK}. */
+    public static final String FEATURE_LEANBACK = "android.software.leanback";
+
+    /** See {@code PackageManager#FEATURE_LEANBACK_ONLY}. */
+    public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
+
+    /** See {@code PackageManager#FEATURE_LIVE_TV}. */
+    public static final String FEATURE_LIVE_TV = "android.software.live_tv";
+
+    /** See {@code PackageManager#FEATURE_WIFI}. */
+    public static final String FEATURE_WIFI = "android.hardware.wifi";
+
+    /** See {@code PackageManager#FEATURE_WIFI_DIRECT}. */
+    public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
+
+    /** See {@code PackageManager#FEATURE_WIFI_AWARE}. */
+    public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
+
+    /** See {@code PackageManager#FEATURE_WIFI_PASSPOINT}. */
+    public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
+
+    /** See {@code PackageManager#FEATURE_WIFI_RTT}. */
+    public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
+
+    /** See {@code PackageManager#FEATURE_LOWPAN}. */
+    public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
+
+    /** See {@code PackageManager#FEATURE_AUTOMOTIVE}. */
+    public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+
+    /** See {@code PackageManager#FEATURE_TELEVISION}. */
+    public static final String FEATURE_TELEVISION = "android.hardware.type.television";
+
+    /** See {@code PackageManager#FEATURE_WATCH}. */
+    public static final String FEATURE_WATCH = "android.hardware.type.watch";
+
+    /** See {@code PackageManager#FEATURE_EMBEDDED}. */
+    public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
+
+    /** See {@code PackageManager#FEATURE_PC}. */
+    public static final String FEATURE_PC = "android.hardware.type.pc";
+
+    /** See {@code PackageManager#FEATURE_PRINTING}. */
+    public static final String FEATURE_PRINTING = "android.software.print";
+
+    /** See {@code PackageManager#FEATURE_COMPANION_DEVICE_SETUP}. */
+    public static final String FEATURE_COMPANION_DEVICE_SETUP =
+            "android.software.companion_device_setup";
+
+    /** See {@code PackageManager#FEATURE_BACKUP}. */
+    public static final String FEATURE_BACKUP = "android.software.backup";
+
+    /** See {@code PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT}. */
+    public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT =
+            "android.software.freeform_window_management";
+
+    /** See {@code PackageManager#FEATURE_PICTURE_IN_PICTURE}. */
+    public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
+
+    /** See {@code PackageManager#FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS}. */
+    public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS =
+            "android.software.activities_on_secondary_displays";
+
+    /** See {@code PackageManager#FEATURE_MANAGED_USERS}. */
+    public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
+
+    /** See {@code PackageManager#FEATURE_MANAGED_PROFILES}. */
+    public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
+
+    /** See {@code PackageManager#FEATURE_NEARBY}. */
+    public static final String FEATURE_NEARBY = "android.software.nearby";
+
+    /** See {@code PackageManager#FEATURE_VERIFIED_BOOT}. */
+    public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
+
+    /** See {@code PackageManager#FEATURE_SECURELY_REMOVES_USERS}. */
+    public static final String FEATURE_SECURELY_REMOVES_USERS =
+            "android.software.securely_removes_users";
+
+    /** See {@code PackageManager#FEATURE_FILE_BASED_ENCRYPTION}. */
+    public static final String FEATURE_FILE_BASED_ENCRYPTION =
+            "android.software.file_based_encryption";
+
+    /** See {@code PackageManager#FEATURE_ADOPTABLE_STORAGE}. */
+    public static final String FEATURE_ADOPTABLE_STORAGE =
+            "android.software.adoptable_storage";
+
+    /** See {@code PackageManager#FEATURE_WEBVIEW}. */
+    public static final String FEATURE_WEBVIEW = "android.software.webview";
+
+    /** See {@code PackageManager#FEATURE_ETHERNET}. */
+    public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
+
+    /** See {@code PackageManager#FEATURE_HDMI_CEC}. */
+    public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
+
+    /** See {@code PackageManager#FEATURE_GAMEPAD}. */
+    public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
+
+    /** See {@code PackageManager#FEATURE_MIDI}. */
+    public static final String FEATURE_MIDI = "android.software.midi";
+
+    /** See {@code PackageManager#FEATURE_VR_MODE}. */
+    public static final String FEATURE_VR_MODE = "android.software.vr.mode";
+
+    /** See {@code PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE}. */
+    public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
+            = "android.hardware.vr.high_performance";
+
+    /** See {@code PackageManager#FEATURE_AUTOFILL}. */
+    public static final String FEATURE_AUTOFILL = "android.software.autofill";
+
+    /** See {@code PackageManager#FEATURE_VR_HEADTRACKING}. */
+    public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
+
+    /** See {@code PackageManager#FEATURE_HARDWARE_KEYSTORE}. */
+    public static final String FEATURE_HARDWARE_KEYSTORE = "android.hardware.hardware_keystore";
+
+    /** See {@code PackageManager#FEATURE_STRONGBOX_KEYSTORE}. */
+    public static final String FEATURE_STRONGBOX_KEYSTORE =
+            "android.hardware.strongbox_keystore";
+
+    /** See {@code PackageManager#FEATURE_SLICES_DISABLED}. */
+    public static final String FEATURE_SLICES_DISABLED = "android.software.slices_disabled";
+
+    /** See {@code PackageManager#FEATURE_DEVICE_UNIQUE_ATTESTATION}. */
+    public static final String FEATURE_DEVICE_UNIQUE_ATTESTATION =
+            "android.hardware.device_unique_attestation";
+
+    /** See {@code PackageManager#FEATURE_DEVICE_ID_ATTESTATION}. */
+    public static final String FEATURE_DEVICE_ID_ATTESTATION =
+            "android.software.device_id_attestation";
+
+    /** See {@code PackageManager#FEATURE_IPSEC_TUNNELS}. */
+    public static final String FEATURE_IPSEC_TUNNELS = "android.software.ipsec_tunnels";
+
+    /** See {@code PackageManager#FEATURE_CONTROLS}. */
+    public static final String FEATURE_CONTROLS = "android.software.controls";
+
+    /** See {@code PackageManager#FEATURE_REBOOT_ESCROW}. */
+    public static final String FEATURE_REBOOT_ESCROW = "android.hardware.reboot_escrow";
+
+    /** See {@code PackageManager#FEATURE_INCREMENTAL_DELIVERY}. */
+    public static final String FEATURE_INCREMENTAL_DELIVERY =
+            "android.software.incremental_delivery";
+
+    /** See {@code PackageManager#FEATURE_TUNER}. */
+    public static final String FEATURE_TUNER = "android.hardware.tv.tuner";
+
+    /** See {@code PackageManager#FEATURE_APP_ENUMERATION}. */
+    public static final String FEATURE_APP_ENUMERATION = "android.software.app_enumeration";
+
+    /** See {@code PackageManager#FEATURE_KEYSTORE_SINGLE_USE_KEY}. */
+    public static final String FEATURE_KEYSTORE_SINGLE_USE_KEY =
+            "android.hardware.keystore.single_use_key";
+
+    /** See {@code PackageManager#FEATURE_KEYSTORE_LIMITED_USE_KEY}. */
+    public static final String FEATURE_KEYSTORE_LIMITED_USE_KEY =
+            "android.hardware.keystore.limited_use_key";
+
+    /** See {@code PackageManager#FEATURE_KEYSTORE_APP_ATTEST_KEY}. */
+    public static final String FEATURE_KEYSTORE_APP_ATTEST_KEY =
+            "android.hardware.keystore.app_attest_key";
+
+    /** See {@code PackageManager#FEATURE_APP_COMPAT_OVERRIDES}. */
+    public static final String FEATURE_APP_COMPAT_OVERRIDES =
+            "android.software.app_compat_overrides";
+
+    /** See {@code PackageManager#FEATURE_COMMUNAL_MODE}. */
+    public static final String FEATURE_COMMUNAL_MODE = "android.software.communal_mode";
+}
diff --git a/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/permissions/CommonPermissions.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/permissions/CommonPermissions.java
new file mode 100644
index 0000000..69d191c
--- /dev/null
+++ b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/permissions/CommonPermissions.java
@@ -0,0 +1,1845 @@
+/*
+ * Copyright (C) 2021 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 com.android.bedstead.nene.permissions;
+
+/** Permissions helper methods common to host and device. */
+public class CommonPermissions {
+
+    CommonPermissions() {
+
+    }
+
+    /** See {@code Manifest#READ_CONTACTS} */
+    public static final String READ_CONTACTS = "android.permission.READ_CONTACTS";
+
+    /** See {@code Manifest#WRITE_CONTACTS} */
+    public static final String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
+
+    /** See {@code Manifest#SET_DEFAULT_ACCOUNT_FOR_CONTACTS} */
+    public static final String SET_DEFAULT_ACCOUNT_FOR_CONTACTS =
+            "android.permission.SET_DEFAULT_ACCOUNT_FOR_CONTACTS";
+
+    /** See {@code Manifest#READ_CALENDAR} */
+    public static final String READ_CALENDAR = "android.permission.READ_CALENDAR";
+
+    /** See {@code Manifest#WRITE_CALENDAR} */
+    public static final String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR";
+
+    /** See {@code Manifest#ACCESS_MESSAGES_ON_ICC} */
+    public static final String ACCESS_MESSAGES_ON_ICC = "android.permission"
+            + ".ACCESS_MESSAGES_ON_ICC";
+
+    /** See {@code Manifest#SEND_SMS} */
+    public static final String SEND_SMS = "android.permission.SEND_SMS";
+
+    /** See {@code Manifest#RECEIVE_SMS} */
+    public static final String RECEIVE_SMS = "android.permission.RECEIVE_SMS";
+
+    /** See {@code Manifest#READ_SMS} */
+    public static final String READ_SMS = "android.permission.READ_SMS";
+
+    /** See {@code Manifest#RECEIVE_WAP_PUSH} */
+    public static final String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
+
+    /** See {@code Manifest#RECEIVE_MMS} */
+    public static final String RECEIVE_MMS = "android.permission.RECEIVE_MMS";
+
+    /** See {@code Manifest#BIND_CELL_BROADCAST_SERVICE} */
+    public static final String BIND_CELL_BROADCAST_SERVICE = "android.permission"
+            + ".BIND_CELL_BROADCAST_SERVICE";
+
+    /** See {@code Manifest#READ_CELL_BROADCASTS} */
+    public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
+
+    /** See {@code Manifest#WRITE_EXTERNAL_STORAGE} */
+    public static final String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
+
+    /** See {@code Manifest#ACCESS_MEDIA_LOCATION} */
+    public static final String ACCESS_MEDIA_LOCATION = "android.permission.ACCESS_MEDIA_LOCATION";
+
+    /** See {@code Manifest#WRITE_OBB} */
+    public static final String WRITE_OBB = "android.permission.WRITE_OBB";
+
+    /** See {@code Manifest#MANAGE_EXTERNAL_STORAGE} */
+    public static final String MANAGE_EXTERNAL_STORAGE = "android.permission"
+            + ".MANAGE_EXTERNAL_STORAGE";
+
+    /** See {@code Manifest#MANAGE_MEDIA} */
+    public static final String MANAGE_MEDIA = "android.permission.MANAGE_MEDIA";
+
+    /** See {@code Manifest#ACCESS_FINE_LOCATION} */
+    public static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
+
+    /** See {@code Manifest#ACCESS_COARSE_LOCATION} */
+    public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
+
+    /** See {@code Manifest#ACCESS_BACKGROUND_LOCATION} */
+    public static final String ACCESS_BACKGROUND_LOCATION =
+            "android.permission.ACCESS_BACKGROUND_LOCATION";
+
+    /** See {@code Manifest#ACCESS_IMS_CALL_SERVICE} */
+    public static final String ACCESS_IMS_CALL_SERVICE = "android.permission"
+            + ".ACCESS_IMS_CALL_SERVICE";
+
+    /** See {@code Manifest#PERFORM_IMS_SINGLE_REGISTRATION} */
+    public static final String PERFORM_IMS_SINGLE_REGISTRATION = "android.permission"
+            + ".PERFORM_IMS_SINGLE_REGISTRATION";
+
+    /** See {@code Manifest#READ_CALL_LOG} */
+    public static final String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
+
+    /** See {@code Manifest#PROCESS_OUTGOING_CALLS} */
+    public static final String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
+
+    /** See {@code Manifest#READ_PHONE_STATE} */
+    public static final String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
+
+    /** See {@code Manifest#READ_BASIC_PHONE_STATE} */
+    public static final String READ_BASIC_PHONE_STATE = "android.permission.READ_BASIC_PHONE_STATE";
+
+    /** See {@code Manifest#READ_PHONE_NUMBERS} */
+    public static final String READ_PHONE_NUMBERS = "android.permission.READ_PHONE_NUMBERS";
+
+    /** See {@code Manifest#CALL_PHONE} */
+    public static final String CALL_PHONE = "android.permission.CALL_PHONE";
+
+    /** See {@code Manifest#ADD_VOICEMAIL} */
+    public static final String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
+
+    /** See {@code Manifest#USE_SIP} */
+    public static final String USE_SIP = "android.permission.USE_SIP";
+
+    /** See {@code Manifest#ANSWER_PHONE_CALLS} */
+    public static final String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
+
+    /** See {@code Manifest#MANAGE_OWN_CALLS} */
+    public static final String MANAGE_OWN_CALLS = "android.permission.MANAGE_OWN_CALLS";
+
+    /** See {@code Manifest#CALL_COMPANION_APP} */
+    public static final String CALL_COMPANION_APP = "android.permission.CALL_COMPANION_APP";
+
+    /** See {@code Manifest#EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS} */
+    public static final String EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS = "android.permission"
+            + ".EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS";
+
+    /** See {@code Manifest#ACCEPT_HANDOVER} */
+    public static final String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER";
+
+    /** See {@code Manifest#RECORD_AUDIO} */
+    public static final String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
+
+    /** See {@code Manifest#RECORD_BACKGROUND_AUDIO} */
+    public static final String RECORD_BACKGROUND_AUDIO =
+            "android.permission.RECORD_BACKGROUND_AUDIO";
+
+    /** See {@code Manifest#ACTIVITY_RECOGNITION} */
+    public static final String ACTIVITY_RECOGNITION = "android.permission.ACTIVITY_RECOGNITION";
+
+    /** See {@code Manifest#ACCESS_UCE_PRESENCE_SERVICE} */
+    public static final String ACCESS_UCE_PRESENCE_SERVICE =
+            "android.permission.ACCESS_UCE_PRESENCE_SERVICE";
+
+    /** See {@code Manifest#ACCESS_UCE_OPTIONS_SERVICE} */
+    public static final String ACCESS_UCE_OPTIONS_SERVICE =
+            "android.permission.ACCESS_UCE_OPTIONS_SERVICE";
+
+    /** See {@code Manifest#CAMERA} */
+    public static final String CAMERA = "android.permission.CAMERA";
+
+    /** See {@code Manifest#BACKGROUND_CAMERA} */
+    public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
+
+    /** See {@code Manifest#SYSTEM_CAMERA} */
+    public static final String SYSTEM_CAMERA = "android.permission.SYSTEM_CAMERA";
+
+    /** See {@code Manifest#CAMERA_OPEN_CLOSE_LISTENER} */
+    public static final String CAMERA_OPEN_CLOSE_LISTENER = "android.permission"
+            + ".CAMERA_OPEN_CLOSE_LISTENER";
+
+    /** See {@code Manifest#HIGH_SAMPLING_RATE_SENSORS} */
+    public static final String HIGH_SAMPLING_RATE_SENSORS =
+            "android.permission.HIGH_SAMPLING_RATE_SENSORS";
+
+    /** See {@code Manifest#BODY_SENSORS} */
+    public static final String BODY_SENSORS = "android.permission.BODY_SENSORS";
+
+    /** See {@code Manifest#USE_FINGERPRINT} */
+    public static final String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
+
+    /** See {@code Manifest#USE_BIOMETRIC} */
+    public static final String USE_BIOMETRIC = "android.permission.USE_BIOMETRIC";
+
+    /** See {@code Manifest#POST_NOTIFICATIONS} */
+    public static final String POST_NOTIFICATIONS = "android.permission.POST_NOTIFICATIONS";
+
+    /** See {@code Manifest#READ_PROFILE} */
+    public static final String READ_PROFILE = "android.permission.READ_PROFILE";
+
+    /** See {@code Manifest#WRITE_PROFILE} */
+    public static final String WRITE_PROFILE = "android.permission.WRITE_PROFILE";
+
+    /** See {@code Manifest#READ_SOCIAL_STREAM} */
+    public static final String READ_SOCIAL_STREAM = "android.permission.READ_SOCIAL_STREAM";
+
+    /** See {@code Manifest#WRITE_SOCIAL_STREAM} */
+    public static final String WRITE_SOCIAL_STREAM = "android.permission.WRITE_SOCIAL_STREAM";
+
+    /** See {@code Manifest#READ_USER_DICTIONARY} */
+    public static final String READ_USER_DICTIONARY = "android.permission.READ_USER_DICTIONARY";
+
+    /** See {@code Manifest#WRITE_USER_DICTIONARY} */
+    public static final String WRITE_USER_DICTIONARY = "android.permission.WRITE_USER_DICTIONARY";
+
+    /** See {@code Manifest#WRITE_SMS} */
+    public static final String WRITE_SMS = "android.permission.WRITE_SMS";
+
+    /** See {@code Manifest#READ_HISTORY_BOOKMARKS} */
+    public static final String READ_HISTORY_BOOKMARKS =
+            "com.android.browser.permission.READ_HISTORY_BOOKMARKS";
+
+    /** See {@code Manifest#WRITE_HISTORY_BOOKMARKS} */
+    public static final String WRITE_HISTORY_BOOKMARKS =
+            "com.android.browser.permission.WRITE_HISTORY_BOOKMARKS";
+
+    /** See {@code Manifest#AUTHENTICATE_ACCOUNTS} */
+    public static final String AUTHENTICATE_ACCOUNTS = "android.permission.AUTHENTICATE_ACCOUNTS";
+
+    /** See {@code Manifest#MANAGE_ACCOUNTS} */
+    public static final String MANAGE_ACCOUNTS = "android.permission.MANAGE_ACCOUNTS";
+
+    /** See {@code Manifest#USE_CREDENTIALS} */
+    public static final String USE_CREDENTIALS = "android.permission.USE_CREDENTIALS";
+
+    /** See {@code Manifest#SUBSCRIBED_FEEDS_READ} */
+    public static final String SUBSCRIBED_FEEDS_READ = "android.permission.SUBSCRIBED_FEEDS_READ";
+
+    /** See {@code Manifest#SUBSCRIBED_FEEDS_WRITE} */
+    public static final String SUBSCRIBED_FEEDS_WRITE = "android.permission"
+            + ".SUBSCRIBED_FEEDS_WRITE";
+
+    /** See {@code Manifest#FLASHLIGHT} */
+    public static final String FLASHLIGHT = "android.permission.FLASHLIGHT";
+
+    /** See {@code Manifest#SEND_RESPOND_VIA_MESSAGE} */
+    public static final String SEND_RESPOND_VIA_MESSAGE =
+            "android.permission.SEND_RESPOND_VIA_MESSAGE";
+
+    /** See {@code Manifest#SEND_SMS_NO_CONFIRMATION} */
+    public static final String SEND_SMS_NO_CONFIRMATION = "android.permission"
+            + ".SEND_SMS_NO_CONFIRMATION";
+
+    /** See {@code Manifest#CARRIER_FILTER_SMS} */
+    public static final String CARRIER_FILTER_SMS = "android.permission.CARRIER_FILTER_SMS";
+
+    /** See {@code Manifest#RECEIVE_EMERGENCY_BROADCAST} */
+    public static final String RECEIVE_EMERGENCY_BROADCAST =
+            "android.permission.RECEIVE_EMERGENCY_BROADCAST";
+
+    /** See {@code Manifest#RECEIVE_BLUETOOTH_MAP} */
+    public static final String RECEIVE_BLUETOOTH_MAP = "android.permission.RECEIVE_BLUETOOTH_MAP";
+
+    /** See {@code Manifest#MODIFY_CELL_BROADCASTS} */
+    public static final String MODIFY_CELL_BROADCASTS =
+            "android.permission.MODIFY_CELL_BROADCASTS";
+
+    /** See {@code Manifest#SET_ALARM} */
+    public static final String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
+
+    /** See {@code Manifest#WRITE_VOICEMAIL} */
+    public static final String WRITE_VOICEMAIL = "com.android.voicemail.permission.WRITE_VOICEMAIL";
+
+    /** See {@code Manifest#READ_VOICEMAIL} */
+    public static final String READ_VOICEMAIL = "com.android.voicemail.permission.READ_VOICEMAIL";
+    /** See {@code Manifest#ACCESS_LOCATION_EXTRA_COMMANDS} */
+    public static final String ACCESS_LOCATION_EXTRA_COMMANDS = "android.permission"
+            + ".ACCESS_LOCATION_EXTRA_COMMANDS";
+    /** See {@code Manifest#INSTALL_LOCATION_PROVIDER} */
+    public static final String INSTALL_LOCATION_PROVIDER = "android.permission"
+            + ".INSTALL_LOCATION_PROVIDER";
+    /** See {@code Manifest#INSTALL_LOCATION_TIME_ZONE_PROVIDER_SERVICE} */
+    public static final String INSTALL_LOCATION_TIME_ZONE_PROVIDER_SERVICE = "android"
+            + ".permission.INSTALL_LOCATION_TIME_ZONE_PROVIDER_SERVICE";
+    /** See {@code Manifest#BIND_TIME_ZONE_PROVIDER_SERVICE} */
+    public static final String BIND_TIME_ZONE_PROVIDER_SERVICE =
+            "android.permission.BIND_TIME_ZONE_PROVIDER_SERVICE";
+    /** See {@code Manifest#HDMI_CEC} */
+    public static final String HDMI_CEC = "android.permission.HDMI_CEC";
+    /** See {@code Manifest#LOCATION_HARDWARE} */
+    public static final String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
+    /** See {@code Manifest#ACCESS_CONTEXT_HUB} */
+    public static final String ACCESS_CONTEXT_HUB = "android.permission.ACCESS_CONTEXT_HUB";
+    /** See {@code Manifest#ACCESS_MOCK_LOCATION} */
+    public static final String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION";
+    /** See {@code Manifest#AUTOMOTIVE_GNSS_CONTROLS} */
+    public static final String AUTOMOTIVE_GNSS_CONTROLS =
+            "android.permission.AUTOMOTIVE_GNSS_CONTROLS";
+    /** See {@code Manifest#INTERNET} */
+    public static final String INTERNET = "android.permission.INTERNET";
+    /** See {@code Manifest#ACCESS_NETWORK_STATE} */
+    public static final String ACCESS_NETWORK_STATE = "android.permission.ACCESS_NETWORK_STATE";
+    /** See {@code Manifest#ACCESS_WIFI_STATE} */
+    public static final String ACCESS_WIFI_STATE = "android.permission.ACCESS_WIFI_STATE";
+    /** See {@code Manifest#CHANGE_WIFI_STATE} */
+    public static final String CHANGE_WIFI_STATE = "android.permission.CHANGE_WIFI_STATE";
+    /** See {@code Manifest#MANAGE_WIFI_AUTO_JOIN} */
+    public static final String MANAGE_WIFI_AUTO_JOIN = "android.permission.MANAGE_WIFI_AUTO_JOIN";
+    /** See {@code Manifest#MANAGE_IPSEC_TUNNELS} */
+    public static final String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
+    /** See {@code Manifest#MANAGE_TEST_NETWORKS} */
+    public static final String MANAGE_TEST_NETWORKS = "android.permission.MANAGE_TEST_NETWORKS";
+    /** See {@code Manifest#READ_WIFI_CREDENTIAL} */
+    public static final String READ_WIFI_CREDENTIAL = "android.permission.READ_WIFI_CREDENTIAL";
+    /** See {@code Manifest#TETHER_PRIVILEGED} */
+    public static final String TETHER_PRIVILEGED = "android.permission.TETHER_PRIVILEGED";
+    /** See {@code Manifest#RECEIVE_WIFI_CREDENTIAL_CHANGE} */
+    public static final String RECEIVE_WIFI_CREDENTIAL_CHANGE = "android.permission"
+            + ".RECEIVE_WIFI_CREDENTIAL_CHANGE";
+    /** See {@code Manifest#OVERRIDE_WIFI_CONFIG} */
+    public static final String OVERRIDE_WIFI_CONFIG = "android.permission.OVERRIDE_WIFI_CONFIG";
+    /** See {@code Manifest#SCORE_NETWORKS} */
+    public static final String SCORE_NETWORKS = "android.permission.SCORE_NETWORKS";
+    /** See {@code Manifest#REQUEST_NETWORK_SCORES} */
+    public static final String REQUEST_NETWORK_SCORES = "android.permission.REQUEST_NETWORK_SCORES";
+    /** See {@code Manifest#RESTART_WIFI_SUBSYSTEM} */
+    public static final String RESTART_WIFI_SUBSYSTEM = "android.permission"
+            + ".RESTART_WIFI_SUBSYSTEM";
+    /** See {@code Manifest#NETWORK_AIRPLANE_MODE} */
+    public static final String NETWORK_AIRPLANE_MODE = "android.permission.NETWORK_AIRPLANE_MODE";
+    /** See {@code Manifest#NETWORK_STACK} */
+    public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
+    /** See {@code Manifest#OBSERVE_NETWORK_POLICY} */
+    public static final String OBSERVE_NETWORK_POLICY = "android.permission"
+            + ".OBSERVE_NETWORK_POLICY";
+    /** See {@code Manifest#NETWORK_FACTORY} */
+    public static final String NETWORK_FACTORY = "android.permission.NETWORK_FACTORY";
+    /** See {@code Manifest#NETWORK_STATS_PROVIDER} */
+    public static final String NETWORK_STATS_PROVIDER = "android.permission.NETWORK_STATS_PROVIDER";
+    /** See {@code Manifest#NETWORK_SETTINGS} */
+    public static final String NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
+    /** See {@code Manifest#RADIO_SCAN_WITHOUT_LOCATION} */
+    public static final String RADIO_SCAN_WITHOUT_LOCATION =
+            "android.permission.RADIO_SCAN_WITHOUT_LOCATION";
+    /** See {@code Manifest#NETWORK_SETUP_WIZARD} */
+    public static final String NETWORK_SETUP_WIZARD = "android.permission.NETWORK_SETUP_WIZARD";
+    /** See {@code Manifest#NETWORK_MANAGED_PROVISIONING} */
+    public static final String NETWORK_MANAGED_PROVISIONING = "android.permission"
+            + ".NETWORK_MANAGED_PROVISIONING";
+    /** See {@code Manifest#NETWORK_CARRIER_PROVISIONING} */
+    public static final String NETWORK_CARRIER_PROVISIONING =
+            "android.permission.NETWORK_CARRIER_PROVISIONING";
+    /** See {@code Manifest#ACCESS_LOWPAN_STATE} */
+    public static final String ACCESS_LOWPAN_STATE = "android.permission.ACCESS_LOWPAN_STATE";
+    /** See {@code Manifest#CHANGE_LOWPAN_STATE} */
+    public static final String CHANGE_LOWPAN_STATE = "android.permission.CHANGE_LOWPAN_STATE";
+    /** See {@code Manifest#READ_LOWPAN_CREDENTIAL} */
+    public static final String READ_LOWPAN_CREDENTIAL = "android.permission.READ_LOWPAN_CREDENTIAL";
+    /** See {@code Manifest#MANAGE_LOWPAN_INTERFACES} */
+    public static final String MANAGE_LOWPAN_INTERFACES = "android.permission"
+            + ".MANAGE_LOWPAN_INTERFACES";
+    /** See {@code Manifest#NETWORK_BYPASS_PRIVATE_DNS} */
+    public static final String NETWORK_BYPASS_PRIVATE_DNS =
+            "android.permission.NETWORK_BYPASS_PRIVATE_DNS";
+    /** See {@code Manifest#WIFI_SET_DEVICE_MOBILITY_STATE} */
+    public static final String WIFI_SET_DEVICE_MOBILITY_STATE =
+            "android.permission.WIFI_SET_DEVICE_MOBILITY_STATE";
+    /** See {@code Manifest#WIFI_UPDATE_USABILITY_STATS_SCORE} */
+    public static final String WIFI_UPDATE_USABILITY_STATS_SCORE = "android.permission"
+            + ".WIFI_UPDATE_USABILITY_STATS_SCORE";
+    /** See {@code Manifest#WIFI_UPDATE_COEX_UNSAFE_CHANNELS} */
+    public static final String WIFI_UPDATE_COEX_UNSAFE_CHANNELS = "android.permission"
+            + ".WIFI_UPDATE_COEX_UNSAFE_CHANNELS";
+    /** See {@code Manifest#WIFI_ACCESS_COEX_UNSAFE_CHANNELS} */
+    public static final String WIFI_ACCESS_COEX_UNSAFE_CHANNELS = "android.permission"
+            + ".WIFI_ACCESS_COEX_UNSAFE_CHANNELS";
+    /** See {@code Manifest#MANAGE_WIFI_COUNTRY_CODE} */
+    public static final String MANAGE_WIFI_COUNTRY_CODE =
+            "android.permission.MANAGE_WIFI_COUNTRY_CODE";
+    /** See {@code Manifest#CONTROL_OEM_PAID_NETWORK_PREFERENCE} */
+    public static final String CONTROL_OEM_PAID_NETWORK_PREFERENCE =
+            "android.permission.CONTROL_OEM_PAID_NETWORK_PREFERENCE";
+    /** See {@code Manifest#BLUETOOTH} */
+    public static final String BLUETOOTH = "android.permission.BLUETOOTH";
+    /** See {@code Manifest#BLUETOOTH_SCAN} */
+    public static final String BLUETOOTH_SCAN = "android.permission.BLUETOOTH_SCAN";
+    /** See {@code Manifest#BLUETOOTH_CONNECT} */
+    public static final String BLUETOOTH_CONNECT = "android.permission.BLUETOOTH_CONNECT";
+    /** See {@code Manifest#BLUETOOTH_ADVERTISE} */
+    public static final String BLUETOOTH_ADVERTISE = "android.permission.BLUETOOTH_ADVERTISE";
+    /** See {@code Manifest#UWB_RANGING} */
+    public static final String UWB_RANGING = "android.permission.UWB_RANGING";
+    /** See {@code Manifest#NEARBY_WIFI_DEVICES} */
+    public static final String NEARBY_WIFI_DEVICES = "android.permission.NEARBY_WIFI_DEVICES";
+    /** See {@code Manifest#SUSPEND_APPS} */
+    public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
+    /** See {@code Manifest#BLUETOOTH_ADMIN} */
+    public static final String BLUETOOTH_ADMIN = "android.permission.BLUETOOTH_ADMIN";
+    /** See {@code Manifest#BLUETOOTH_PRIVILEGED} */
+    public static final String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
+    /** See {@code Manifest#BLUETOOTH_MAP} */
+    public static final String BLUETOOTH_MAP = "android.permission.BLUETOOTH_MAP";
+    /** See {@code Manifest#BLUETOOTH_STACK} */
+    public static final String BLUETOOTH_STACK = "android.permission.BLUETOOTH_STACK";
+    /** See {@code Manifest#VIRTUAL_INPUT_DEVICE} */
+    public static final String VIRTUAL_INPUT_DEVICE = "android.permission.VIRTUAL_INPUT_DEVICE";
+    /** See {@code Manifest#NFC} */
+    public static final String NFC = "android.permission.NFC";
+    /** See {@code Manifest#NFC_TRANSACTION_EVENT} */
+    public static final String NFC_TRANSACTION_EVENT = "android.permission.NFC_TRANSACTION_EVENT";
+    /** See {@code Manifest#NFC_PREFERRED_PAYMENT_INFO} */
+    public static final String NFC_PREFERRED_PAYMENT_INFO =
+            "android.permission.NFC_PREFERRED_PAYMENT_INFO";
+    /** See {@code Manifest#NFC_SET_CONTROLLER_ALWAYS_ON} */
+    public static final String NFC_SET_CONTROLLER_ALWAYS_ON = "android.permission"
+            + ".NFC_SET_CONTROLLER_ALWAYS_ON";
+    /** See {@code Manifest#SECURE_ELEMENT_PRIVILEGED_OPERATION} */
+    public static final String SECURE_ELEMENT_PRIVILEGED_OPERATION = "android.permission"
+            + ".SECURE_ELEMENT_PRIVILEGED_OPERATION";
+    /** See {@code Manifest#CONNECTIVITY_INTERNAL} */
+    public static final String CONNECTIVITY_INTERNAL = "android.permission.CONNECTIVITY_INTERNAL";
+    /** See {@code Manifest#CONNECTIVITY_USE_RESTRICTED_NETWORKS} */
+    public static final String CONNECTIVITY_USE_RESTRICTED_NETWORKS =
+            "android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS";
+    /** See {@code Manifest#NETWORK_SIGNAL_STRENGTH_WAKEUP} */
+    public static final String NETWORK_SIGNAL_STRENGTH_WAKEUP =
+            "android.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP";
+    /** See {@code Manifest#PACKET_KEEPALIVE_OFFLOAD} */
+    public static final String PACKET_KEEPALIVE_OFFLOAD =
+            "android.permission.PACKET_KEEPALIVE_OFFLOAD";
+    /** See {@code Manifest#RECEIVE_DATA_ACTIVITY_CHANGE} */
+    public static final String RECEIVE_DATA_ACTIVITY_CHANGE =
+            "android.permission.RECEIVE_DATA_ACTIVITY_CHANGE";
+    /** See {@code Manifest#LOOP_RADIO} */
+    public static final String LOOP_RADIO = "android.permission.LOOP_RADIO";
+    /** See {@code Manifest#NFC_HANDOVER_STATUS} */
+    public static final String NFC_HANDOVER_STATUS = "android.permission.NFC_HANDOVER_STATUS";
+    /** See {@code Manifest#MANAGE_BLUETOOTH_WHEN_WIRELESS_CONSENT_REQUIRED} */
+    public static final String MANAGE_BLUETOOTH_WHEN_WIRELESS_CONSENT_REQUIRED =
+            "android.permission.MANAGE_BLUETOOTH_WHEN_WIRELESS_CONSENT_REQUIRED";
+    /** See {@code Manifest#ENABLE_TEST_HARNESS_MODE} */
+    public static final String ENABLE_TEST_HARNESS_MODE =
+            "android.permission.ENABLE_TEST_HARNESS_MODE";
+    /** See {@code Manifest#GET_ACCOUNTS} */
+    public static final String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
+    /** See {@code Manifest#ACCOUNT_MANAGER} */
+    public static final String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER";
+    /** See {@code Manifest#CHANGE_WIFI_MULTICAST_STATE} */
+    public static final String CHANGE_WIFI_MULTICAST_STATE = "android.permission"
+            + ".CHANGE_WIFI_MULTICAST_STATE";
+    /** See {@code Manifest#VIBRATE} */
+    public static final String VIBRATE = "android.permission.VIBRATE";
+    /** See {@code Manifest#VIBRATE_ALWAYS_ON} */
+    public static final String VIBRATE_ALWAYS_ON = "android.permission.VIBRATE_ALWAYS_ON";
+    /** See {@code Manifest#ACCESS_VIBRATOR_STATE} */
+    public static final String ACCESS_VIBRATOR_STATE = "android.permission.ACCESS_VIBRATOR_STATE";
+    /** See {@code Manifest#WAKE_LOCK} */
+    public static final String WAKE_LOCK = "android.permission.WAKE_LOCK";
+    /** See {@code Manifest#TRANSMIT_IR} */
+    public static final String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
+    /** See {@code Manifest#MODIFY_AUDIO_SETTINGS} */
+    public static final String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
+    /** See {@code Manifest#MANAGE_FACTORY_RESET_PROTECTION} */
+    public static final String MANAGE_FACTORY_RESET_PROTECTION = "android.permission"
+            + ".MANAGE_FACTORY_RESET_PROTECTION";
+    /** See {@code Manifest#MANAGE_USB} */
+    public static final String MANAGE_USB = "android.permission.MANAGE_USB";
+    /** See {@code Manifest#MANAGE_DEBUGGING} */
+    public static final String MANAGE_DEBUGGING = "android.permission.MANAGE_DEBUGGING";
+    /** See {@code Manifest#ACCESS_MTP} */
+    public static final String ACCESS_MTP = "android.permission.ACCESS_MTP";
+    /** See {@code Manifest#HARDWARE_TEST} */
+    public static final String HARDWARE_TEST = "android.permission.HARDWARE_TEST";
+    /** See {@code Manifest#MANAGE_DYNAMIC_SYSTEM} */
+    public static final String MANAGE_DYNAMIC_SYSTEM = "android.permission.MANAGE_DYNAMIC_SYSTEM";
+    /** See {@code Manifest#INSTALL_DYNAMIC_SYSTEM} */
+    public static final String INSTALL_DYNAMIC_SYSTEM = "android.permission"
+            + ".INSTALL_DYNAMIC_SYSTEM";
+    /** See {@code Manifest#ACCESS_BROADCAST_RADIO} */
+    public static final String ACCESS_BROADCAST_RADIO = "android.permission"
+            + ".ACCESS_BROADCAST_RADIO";
+    /** See {@code Manifest#ACCESS_FM_RADIO} */
+    public static final String ACCESS_FM_RADIO = "android.permission.ACCESS_FM_RADIO";
+    /** See {@code Manifest#NET_ADMIN} */
+    public static final String NET_ADMIN = "android.permission.NET_ADMIN";
+    /** See {@code Manifest#REMOTE_AUDIO_PLAYBACK} */
+    public static final String REMOTE_AUDIO_PLAYBACK = "android.permission.REMOTE_AUDIO_PLAYBACK";
+    /** See {@code Manifest#TV_INPUT_HARDWARE} */
+    public static final String TV_INPUT_HARDWARE = "android.permission.TV_INPUT_HARDWARE";
+    /** See {@code Manifest#CAPTURE_TV_INPUT} */
+    public static final String CAPTURE_TV_INPUT = "android.permission.CAPTURE_TV_INPUT";
+    /** See {@code Manifest#DVB_DEVICE} */
+    public static final String DVB_DEVICE = "android.permission.DVB_DEVICE";
+    /** See {@code Manifest#MANAGE_CARRIER_OEM_UNLOCK_STATE} */
+    public static final String MANAGE_CARRIER_OEM_UNLOCK_STATE = "android.permission"
+            + ".MANAGE_CARRIER_OEM_UNLOCK_STATE";
+    /** See {@code Manifest#MANAGE_USER_OEM_UNLOCK_STATE} */
+    public static final String MANAGE_USER_OEM_UNLOCK_STATE = "android.permission"
+            + ".MANAGE_USER_OEM_UNLOCK_STATE";
+    /** See {@code Manifest#READ_OEM_UNLOCK_STATE} */
+    public static final String READ_OEM_UNLOCK_STATE = "android.permission.READ_OEM_UNLOCK_STATE";
+    /** See {@code Manifest#OEM_UNLOCK_STATE} */
+    public static final String OEM_UNLOCK_STATE = "android.permission.OEM_UNLOCK_STATE";
+    /** See {@code Manifest#ACCESS_PDB_STATE} */
+    public static final String ACCESS_PDB_STATE = "android.permission.ACCESS_PDB_STATE";
+    /** See {@code Manifest#TEST_BLACKLISTED_PASSWORD} */
+    public static final String TEST_BLACKLISTED_PASSWORD =
+            "android.permission.TEST_BLACKLISTED_PASSWORD";
+    /** See {@code Manifest#NOTIFY_PENDING_SYSTEM_UPDATE} */
+    public static final String NOTIFY_PENDING_SYSTEM_UPDATE =
+            "android.permission.NOTIFY_PENDING_SYSTEM_UPDATE";
+    /** See {@code Manifest#CAMERA_DISABLE_TRANSMIT_LED} */
+    public static final String CAMERA_DISABLE_TRANSMIT_LED =
+            "android.permission.CAMERA_DISABLE_TRANSMIT_LED";
+    /** See {@code Manifest#CAMERA_SEND_SYSTEM_EVENTS} */
+    public static final String CAMERA_SEND_SYSTEM_EVENTS =
+            "android.permission.CAMERA_SEND_SYSTEM_EVENTS";
+    /** See {@code Manifest#CAMERA_INJECT_EXTERNAL_CAMERA} */
+    public static final String CAMERA_INJECT_EXTERNAL_CAMERA =
+            "android.permission.CAMERA_INJECT_EXTERNAL_CAMERA";
+    /** See {@code Manifest#GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS} */
+    public static final String GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS = "android"
+            + ".permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS";
+    /** See {@code Manifest#MODIFY_PHONE_STATE} */
+    public static final String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
+    /** See {@code Manifest#READ_PRECISE_PHONE_STATE} */
+    public static final String READ_PRECISE_PHONE_STATE =
+            "android.permission.READ_PRECISE_PHONE_STATE";
+    /** See {@code Manifest#READ_PRIVILEGED_PHONE_STATE} */
+    public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission"
+            + ".READ_PRIVILEGED_PHONE_STATE";
+    /** See {@code Manifest#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} */
+    public static final String USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER =
+            "android.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER";
+    /** See {@code Manifest#READ_ACTIVE_EMERGENCY_SESSION} */
+    public static final String READ_ACTIVE_EMERGENCY_SESSION = "android.permission"
+            + ".READ_ACTIVE_EMERGENCY_SESSION";
+    /** See {@code Manifest#LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH} */
+    public static final String LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH = "android.permission"
+            + ".LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH";
+    /** See {@code Manifest#REGISTER_SIM_SUBSCRIPTION} */
+    public static final String REGISTER_SIM_SUBSCRIPTION =
+            "android.permission.REGISTER_SIM_SUBSCRIPTION";
+    /** See {@code Manifest#REGISTER_CALL_PROVIDER} */
+    public static final String REGISTER_CALL_PROVIDER = "android.permission"
+            + ".REGISTER_CALL_PROVIDER";
+    /** See {@code Manifest#REGISTER_CONNECTION_MANAGER} */
+    public static final String REGISTER_CONNECTION_MANAGER =
+            "android.permission.REGISTER_CONNECTION_MANAGER";
+    /** See {@code Manifest#BIND_INCALL_SERVICE} */
+    public static final String BIND_INCALL_SERVICE = "android.permission.BIND_INCALL_SERVICE";
+    /** See {@code Manifest#MANAGE_ONGOING_CALLS} */
+    public static final String MANAGE_ONGOING_CALLS = "android.permission.MANAGE_ONGOING_CALLS";
+    /** See {@code Manifest#NETWORK_SCAN} */
+    public static final String NETWORK_SCAN = "android.permission.NETWORK_SCAN";
+    /** See {@code Manifest#BIND_VISUAL_VOICEMAIL_SERVICE} */
+    public static final String BIND_VISUAL_VOICEMAIL_SERVICE = "android.permission"
+            + ".BIND_VISUAL_VOICEMAIL_SERVICE";
+    /** See {@code Manifest#BIND_SCREENING_SERVICE} */
+    public static final String BIND_SCREENING_SERVICE = "android.permission.BIND_SCREENING_SERVICE";
+    /** See {@code Manifest#BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE} */
+    public static final String BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE =
+            "android.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE";
+    /** See {@code Manifest#BIND_CALL_DIAGNOSTIC_SERVICE} */
+    public static final String BIND_CALL_DIAGNOSTIC_SERVICE = "android.permission"
+            + ".BIND_CALL_DIAGNOSTIC_SERVICE";
+    /** See {@code Manifest#BIND_CALL_REDIRECTION_SERVICE} */
+    public static final String BIND_CALL_REDIRECTION_SERVICE =
+            "android.permission.BIND_CALL_REDIRECTION_SERVICE";
+    /** See {@code Manifest#BIND_CONNECTION_SERVICE} */
+    public static final String BIND_CONNECTION_SERVICE =
+            "android.permission.BIND_CONNECTION_SERVICE";
+    /** See {@code Manifest#BIND_TELECOM_CONNECTION_SERVICE} */
+    public static final String BIND_TELECOM_CONNECTION_SERVICE = "android.permission"
+            + ".BIND_TELECOM_CONNECTION_SERVICE";
+    /** See {@code Manifest#CONTROL_INCALL_EXPERIENCE} */
+    public static final String CONTROL_INCALL_EXPERIENCE = "android.permission"
+            + ".CONTROL_INCALL_EXPERIENCE";
+    /** See {@code Manifest#RECEIVE_STK_COMMANDS} */
+    public static final String RECEIVE_STK_COMMANDS = "android.permission.RECEIVE_STK_COMMANDS";
+    /** See {@code Manifest#SEND_EMBMS_INTENTS} */
+    public static final String SEND_EMBMS_INTENTS = "android.permission.SEND_EMBMS_INTENTS";
+    /** See {@code Manifest#MANAGE_SENSORS} */
+    public static final String MANAGE_SENSORS = "android.permission.MANAGE_SENSORS";
+    /** See {@code Manifest#BIND_IMS_SERVICE} */
+    public static final String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE";
+    /** See {@code Manifest#BIND_TELEPHONY_DATA_SERVICE} */
+    public static final String BIND_TELEPHONY_DATA_SERVICE =
+            "android.permission.BIND_TELEPHONY_DATA_SERVICE";
+    /** See {@code Manifest#BIND_TELEPHONY_NETWORK_SERVICE} */
+    public static final String BIND_TELEPHONY_NETWORK_SERVICE =
+            "android.permission.BIND_TELEPHONY_NETWORK_SERVICE";
+    /** See {@code Manifest#WRITE_EMBEDDED_SUBSCRIPTIONS} */
+    public static final String WRITE_EMBEDDED_SUBSCRIPTIONS = "android.permission"
+            + ".WRITE_EMBEDDED_SUBSCRIPTIONS";
+    /** See {@code Manifest#BIND_EUICC_SERVICE} */
+    public static final String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
+    /** See {@code Manifest#READ_CARRIER_APP_INFO} */
+    public static final String READ_CARRIER_APP_INFO = "android.permission.READ_CARRIER_APP_INFO";
+    /** See {@code Manifest#BIND_GBA_SERVICE} */
+    public static final String BIND_GBA_SERVICE = "android.permission.BIND_GBA_SERVICE";
+    /** See {@code Manifest#ACCESS_RCS_USER_CAPABILITY_EXCHANGE} */
+    public static final String ACCESS_RCS_USER_CAPABILITY_EXCHANGE =
+            "android.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE";
+    /** See {@code Manifest#WRITE_MEDIA_STORAGE} */
+    public static final String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE";
+    /** See {@code Manifest#MANAGE_DOCUMENTS} */
+    public static final String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS";
+    /** See {@code Manifest#CACHE_CONTENT} */
+    public static final String CACHE_CONTENT = "android.permission.CACHE_CONTENT";
+    /** See {@code Manifest#ALLOCATE_AGGRESSIVE} */
+    public static final String ALLOCATE_AGGRESSIVE = "android.permission.ALLOCATE_AGGRESSIVE";
+    /** See {@code Manifest#USE_RESERVED_DISK} */
+    public static final String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK";
+    /** See {@code Manifest#DISABLE_KEYGUARD} */
+    public static final String DISABLE_KEYGUARD = "android.permission.DISABLE_KEYGUARD";
+    /** See {@code Manifest#REQUEST_PASSWORD_COMPLEXITY} */
+    public static final String REQUEST_PASSWORD_COMPLEXITY =
+            "android.permission.REQUEST_PASSWORD_COMPLEXITY";
+    /** See {@code Manifest#GET_TASKS} */
+    public static final String GET_TASKS = "android.permission.GET_TASKS";
+    /** See {@code Manifest#REAL_GET_TASKS} */
+    public static final String REAL_GET_TASKS = "android.permission.REAL_GET_TASKS";
+    /** See {@code Manifest#START_TASKS_FROM_RECENTS} */
+    public static final String START_TASKS_FROM_RECENTS =
+            "android.permission.START_TASKS_FROM_RECENTS";
+    /** See {@code Manifest#INTERACT_ACROSS_USERS} */
+    public static final String INTERACT_ACROSS_USERS = "android.permission.INTERACT_ACROSS_USERS";
+    /** See {@code Manifest#INTERACT_ACROSS_USERS_FULL} */
+    public static final String INTERACT_ACROSS_USERS_FULL =
+            "android.permission.INTERACT_ACROSS_USERS_FULL";
+    /** See {@code Manifest#INTERACT_ACROSS_PROFILES} */
+    public static final String INTERACT_ACROSS_PROFILES = "android.permission"
+            + ".INTERACT_ACROSS_PROFILES";
+    /** See {@code Manifest#CONFIGURE_INTERACT_ACROSS_PROFILES} */
+    public static final String CONFIGURE_INTERACT_ACROSS_PROFILES =
+            "android.permission.CONFIGURE_INTERACT_ACROSS_PROFILES";
+    /** See {@code Manifest#MANAGE_USERS} */
+    public static final String MANAGE_USERS = "android.permission.MANAGE_USERS";
+    /** See {@code Manifest#CREATE_USERS} */
+    public static final String CREATE_USERS = "android.permission.CREATE_USERS";
+    /** See {@code Manifest#QUERY_USERS} */
+    public static final String QUERY_USERS = "android.permission.QUERY_USERS";
+    /** See {@code Manifest#ACCESS_BLOBS_ACROSS_USERS} */
+    public static final String ACCESS_BLOBS_ACROSS_USERS = "android.permission"
+            + ".ACCESS_BLOBS_ACROSS_USERS";
+    /** See {@code Manifest#MANAGE_PROFILE_AND_DEVICE_OWNERS} */
+    public static final String MANAGE_PROFILE_AND_DEVICE_OWNERS = "android.permission"
+            + ".MANAGE_PROFILE_AND_DEVICE_OWNERS";
+    /** See {@code Manifest#QUERY_ADMIN_POLICY} */
+    public static final String QUERY_ADMIN_POLICY = "android.permission.QUERY_ADMIN_POLICY";
+    /** See {@code Manifest#CLEAR_FREEZE_PERIOD} */
+    public static final String CLEAR_FREEZE_PERIOD = "android.permission.CLEAR_FREEZE_PERIOD";
+    /** See {@code Manifest#FORCE_DEVICE_POLICY_MANAGER_LOGS} */
+    public static final String FORCE_DEVICE_POLICY_MANAGER_LOGS = "android.permission"
+            + ".FORCE_DEVICE_POLICY_MANAGER_LOGS";
+    /** See {@code Manifest#GET_DETAILED_TASKS} */
+    public static final String GET_DETAILED_TASKS = "android.permission.GET_DETAILED_TASKS";
+    /** See {@code Manifest#REORDER_TASKS} */
+    public static final String REORDER_TASKS = "android.permission.REORDER_TASKS";
+    /** See {@code Manifest#REMOVE_TASKS} */
+    public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
+    /** See {@code Manifest#MANAGE_ACTIVITY_STACKS} */
+    public static final String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
+    /** See {@code Manifest#MANAGE_ACTIVITY_TASKS} */
+    public static final String MANAGE_ACTIVITY_TASKS = "android.permission.MANAGE_ACTIVITY_TASKS";
+    /** See {@code Manifest#ACTIVITY_EMBEDDING} */
+    public static final String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
+    /** See {@code Manifest#START_ANY_ACTIVITY} */
+    public static final String START_ANY_ACTIVITY = "android.permission.START_ANY_ACTIVITY";
+    /** See {@code Manifest#START_ACTIVITIES_FROM_BACKGROUND} */
+    public static final String START_ACTIVITIES_FROM_BACKGROUND = "android.permission"
+            + ".START_ACTIVITIES_FROM_BACKGROUND";
+    /** See {@code Manifest#START_FOREGROUND_SERVICES_FROM_BACKGROUND} */
+    public static final String START_FOREGROUND_SERVICES_FROM_BACKGROUND = "android.permission"
+            + ".START_FOREGROUND_SERVICES_FROM_BACKGROUND";
+    /** See {@code Manifest#SEND_SHOW_SUSPENDED_APP_DETAILS} */
+    public static final String SEND_SHOW_SUSPENDED_APP_DETAILS = "android.permission"
+            + ".SEND_SHOW_SUSPENDED_APP_DETAILS";
+    /** See {@code Manifest#START_ACTIVITY_AS_CALLER} */
+    public static final String START_ACTIVITY_AS_CALLER = "android.permission"
+            + ".START_ACTIVITY_AS_CALLER";
+    /** See {@code Manifest#RESTART_PACKAGES} */
+    public static final String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
+    /** See {@code Manifest#GET_PROCESS_STATE_AND_OOM_SCORE} */
+    public static final String GET_PROCESS_STATE_AND_OOM_SCORE =
+            "android.permission.GET_PROCESS_STATE_AND_OOM_SCORE";
+    /** See {@code Manifest#GET_INTENT_SENDER_INTENT} */
+    public static final String GET_INTENT_SENDER_INTENT =
+            "android.permission.GET_INTENT_SENDER_INTENT";
+    /** See {@code Manifest#SYSTEM_ALERT_WINDOW} */
+    public static final String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW";
+    /** See {@code Manifest#SYSTEM_APPLICATION_OVERLAY} */
+    public static final String SYSTEM_APPLICATION_OVERLAY =
+            "android.permission.SYSTEM_APPLICATION_OVERLAY";
+    /** See {@code Manifest#RUN_IN_BACKGROUND} */
+    public static final String RUN_IN_BACKGROUND = "android.permission.RUN_IN_BACKGROUND";
+    /** See {@code Manifest#USE_DATA_IN_BACKGROUND} */
+    public static final String USE_DATA_IN_BACKGROUND = "android.permission"
+            + ".USE_DATA_IN_BACKGROUND";
+    /** See {@code Manifest#SET_DISPLAY_OFFSET} */
+    public static final String SET_DISPLAY_OFFSET = "android.permission.SET_DISPLAY_OFFSET";
+    /** See {@code Manifest#REQUEST_COMPANION_RUN_IN_BACKGROUND} */
+    public static final String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission"
+            + ".REQUEST_COMPANION_RUN_IN_BACKGROUND";
+    /** See {@code Manifest#REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND} */
+    public static final String REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND =
+            "android.permission.REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND";
+    /** See {@code Manifest#REQUEST_COMPANION_USE_DATA_IN_BACKGROUND} */
+    public static final String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission"
+            + ".REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
+    /** See {@code Manifest#REQUEST_COMPANION_PROFILE_WATCH} */
+    public static final String REQUEST_COMPANION_PROFILE_WATCH =
+            "android.permission.REQUEST_COMPANION_PROFILE_WATCH";
+    /** See {@code Manifest#REQUEST_COMPANION_PROFILE_APP_STREAMING} */
+    public static final String REQUEST_COMPANION_PROFILE_APP_STREAMING = "android.permission"
+            + ".REQUEST_COMPANION_PROFILE_APP_STREAMING";
+    /** See {@code Manifest#REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION} */
+    public static final String REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION =
+            "android.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION";
+    /** See {@code Manifest#REQUEST_COMPANION_SELF_MANAGED} */
+    public static final String REQUEST_COMPANION_SELF_MANAGED = "android.permission"
+            + ".REQUEST_COMPANION_SELF_MANAGED";
+    /** See {@code Manifest#COMPANION_APPROVE_WIFI_CONNECTIONS} */
+    public static final String COMPANION_APPROVE_WIFI_CONNECTIONS = "android.permission"
+            + ".COMPANION_APPROVE_WIFI_CONNECTIONS";
+    /** See {@code Manifest#READ_PROJECTION_STATE} */
+    public static final String READ_PROJECTION_STATE = "android.permission.READ_PROJECTION_STATE";
+    /** See {@code Manifest#TOGGLE_AUTOMOTIVE_PROJECTION} */
+    public static final String TOGGLE_AUTOMOTIVE_PROJECTION =
+            "android.permission.TOGGLE_AUTOMOTIVE_PROJECTION";
+    /** See {@code Manifest#HIDE_OVERLAY_WINDOWS} */
+    public static final String HIDE_OVERLAY_WINDOWS = "android.permission.HIDE_OVERLAY_WINDOWS";
+    /** See {@code Manifest#SET_WALLPAPER} */
+    public static final String SET_WALLPAPER = "android.permission.SET_WALLPAPER";
+    /** See {@code Manifest#SET_WALLPAPER_HINTS} */
+    public static final String SET_WALLPAPER_HINTS = "android.permission.SET_WALLPAPER_HINTS";
+    /** See {@code Manifest#READ_WALLPAPER_INTERNAL} */
+    public static final String READ_WALLPAPER_INTERNAL = "android.permission"
+            + ".READ_WALLPAPER_INTERNAL";
+    /** See {@code Manifest#SET_TIME} */
+    public static final String SET_TIME = "android.permission.SET_TIME";
+    /** See {@code Manifest#SET_TIME_ZONE} */
+    public static final String SET_TIME_ZONE = "android.permission.SET_TIME_ZONE";
+    /** See {@code Manifest#SUGGEST_TELEPHONY_TIME_AND_ZONE} */
+    public static final String SUGGEST_TELEPHONY_TIME_AND_ZONE =
+            "android.permission.SUGGEST_TELEPHONY_TIME_AND_ZONE";
+    /** See {@code Manifest#SUGGEST_MANUAL_TIME_AND_ZONE} */
+    public static final String SUGGEST_MANUAL_TIME_AND_ZONE = "android.permission"
+            + ".SUGGEST_MANUAL_TIME_AND_ZONE";
+    /** See {@code Manifest#SUGGEST_EXTERNAL_TIME} */
+    public static final String SUGGEST_EXTERNAL_TIME = "android.permission.SUGGEST_EXTERNAL_TIME";
+    /** See {@code Manifest#MANAGE_TIME_AND_ZONE_DETECTION} */
+    public static final String MANAGE_TIME_AND_ZONE_DETECTION = "android.permission"
+            + ".MANAGE_TIME_AND_ZONE_DETECTION";
+    /** See {@code Manifest#EXPAND_STATUS_BAR} */
+    public static final String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR";
+    /** See {@code Manifest#INSTALL_SHORTCUT} */
+    public static final String INSTALL_SHORTCUT = "com.android.launcher.permission"
+            + ".INSTALL_SHORTCUT";
+    /** See {@code Manifest#READ_SYNC_SETTINGS} */
+    public static final String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
+    /** See {@code Manifest#WRITE_SYNC_SETTINGS} */
+    public static final String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS";
+    /** See {@code Manifest#READ_SYNC_STATS} */
+    public static final String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
+    /** See {@code Manifest#SET_SCREEN_COMPATIBILITY} */
+    public static final String SET_SCREEN_COMPATIBILITY = "android.permission"
+            + ".SET_SCREEN_COMPATIBILITY";
+    /** See {@code Manifest#CHANGE_CONFIGURATION} */
+    public static final String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION";
+    /** See {@code Manifest#WRITE_GSERVICES} */
+    public static final String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
+    /** See {@code Manifest#WRITE_DEVICE_CONFIG} */
+    public static final String WRITE_DEVICE_CONFIG = "android.permission.WRITE_DEVICE_CONFIG";
+    /** See {@code Manifest#READ_DEVICE_CONFIG} */
+    public static final String READ_DEVICE_CONFIG = "android.permission.READ_DEVICE_CONFIG";
+    /** See {@code Manifest#READ_APP_SPECIFIC_LOCALES} */
+    public static final String READ_APP_SPECIFIC_LOCALES =
+            "android.permission.READ_APP_SPECIFIC_LOCALES";
+    /** See {@code Manifest#MONITOR_DEVICE_CONFIG_ACCESS} */
+    public static final String MONITOR_DEVICE_CONFIG_ACCESS =
+            "android.permission.MONITOR_DEVICE_CONFIG_ACCESS";
+    /** See {@code Manifest#FORCE_STOP_PACKAGES} */
+    public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
+    /** See {@code Manifest#RETRIEVE_WINDOW_CONTENT} */
+    public static final String RETRIEVE_WINDOW_CONTENT =
+            "android.permission.RETRIEVE_WINDOW_CONTENT";
+    /** See {@code Manifest#SET_ANIMATION_SCALE} */
+    public static final String SET_ANIMATION_SCALE = "android.permission.SET_ANIMATION_SCALE";
+    /** See {@code Manifest#PERSISTENT_ACTIVITY} */
+    public static final String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY";
+    /** See {@code Manifest#GET_PACKAGE_SIZE} */
+    public static final String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE";
+    /** See {@code Manifest#RECEIVE_BOOT_COMPLETED} */
+    public static final String RECEIVE_BOOT_COMPLETED = "android.permission.RECEIVE_BOOT_COMPLETED";
+    /** See {@code Manifest#BROADCAST_STICKY} */
+    public static final String BROADCAST_STICKY = "android.permission.BROADCAST_STICKY";
+    /** See {@code Manifest#MOUNT_UNMOUNT_FILESYSTEMS} */
+    public static final String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission"
+            + ".MOUNT_UNMOUNT_FILESYSTEMS";
+    /** See {@code Manifest#MOUNT_FORMAT_FILESYSTEMS} */
+    public static final String MOUNT_FORMAT_FILESYSTEMS = "android.permission"
+            + ".MOUNT_FORMAT_FILESYSTEMS";
+    /** See {@code Manifest#STORAGE_INTERNAL} */
+    public static final String STORAGE_INTERNAL = "android.permission.STORAGE_INTERNAL";
+    /** See {@code Manifest#ASEC_ACCESS} */
+    public static final String ASEC_ACCESS = "android.permission.ASEC_ACCESS";
+    /** See {@code Manifest#ASEC_CREATE} */
+    public static final String ASEC_CREATE = "android.permission.ASEC_CREATE";
+    /** See {@code Manifest#ASEC_DESTROY} */
+    public static final String ASEC_DESTROY = "android.permission.ASEC_DESTROY";
+    /** See {@code Manifest#ASEC_MOUNT_UNMOUNT} */
+    public static final String ASEC_MOUNT_UNMOUNT = "android.permission.ASEC_MOUNT_UNMOUNT";
+    /** See {@code Manifest#ASEC_RENAME} */
+    public static final String ASEC_RENAME = "android.permission.ASEC_RENAME";
+    /** See {@code Manifest#WRITE_APN_SETTINGS} */
+    public static final String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS";
+    /** See {@code Manifest#CHANGE_NETWORK_STATE} */
+    public static final String CHANGE_NETWORK_STATE = "android.permission.CHANGE_NETWORK_STATE";
+    /** See {@code Manifest#CLEAR_APP_CACHE} */
+    public static final String CLEAR_APP_CACHE = "android.permission.CLEAR_APP_CACHE";
+    /** See {@code Manifest#ALLOW_ANY_CODEC_FOR_PLAYBACK} */
+    public static final String ALLOW_ANY_CODEC_FOR_PLAYBACK = "android.permission"
+            + ".ALLOW_ANY_CODEC_FOR_PLAYBACK";
+    /** See {@code Manifest#MANAGE_CA_CERTIFICATES} */
+    public static final String MANAGE_CA_CERTIFICATES = "android.permission"
+            + ".MANAGE_CA_CERTIFICATES";
+    /** See {@code Manifest#RECOVERY} */
+    public static final String RECOVERY = "android.permission.RECOVERY";
+    /** See {@code Manifest#BIND_RESUME_ON_REBOOT_SERVICE} */
+    public static final String BIND_RESUME_ON_REBOOT_SERVICE = "android.permission"
+            + ".BIND_RESUME_ON_REBOOT_SERVICE";
+    /** See {@code Manifest#READ_SYSTEM_UPDATE_INFO} */
+    public static final String READ_SYSTEM_UPDATE_INFO = "android.permission"
+            + ".READ_SYSTEM_UPDATE_INFO";
+    /** See {@code Manifest#BIND_JOB_SERVICE} */
+    public static final String BIND_JOB_SERVICE = "android.permission.BIND_JOB_SERVICE";
+    /** See {@code Manifest#UPDATE_CONFIG} */
+    public static final String UPDATE_CONFIG = "android.permission.UPDATE_CONFIG";
+    /** See {@code Manifest#QUERY_TIME_ZONE_RULES} */
+    public static final String QUERY_TIME_ZONE_RULES = "android.permission.QUERY_TIME_ZONE_RULES";
+    /** See {@code Manifest#UPDATE_TIME_ZONE_RULES} */
+    public static final String UPDATE_TIME_ZONE_RULES = "android.permission"
+            + ".UPDATE_TIME_ZONE_RULES";
+    /** See {@code Manifest#TRIGGER_TIME_ZONE_RULES_CHECK} */
+    public static final String TRIGGER_TIME_ZONE_RULES_CHECK = "android.permission"
+            + ".TRIGGER_TIME_ZONE_RULES_CHECK";
+    /** See {@code Manifest#RESET_SHORTCUT_MANAGER_THROTTLING} */
+    public static final String RESET_SHORTCUT_MANAGER_THROTTLING =
+            "android.permission.RESET_SHORTCUT_MANAGER_THROTTLING";
+    /** See {@code Manifest#BIND_NETWORK_RECOMMENDATION_SERVICE} */
+    public static final String BIND_NETWORK_RECOMMENDATION_SERVICE =
+            "android.permission.BIND_NETWORK_RECOMMENDATION_SERVICE";
+    /** See {@code Manifest#MANAGE_CREDENTIAL_MANAGEMENT_APP} */
+    public static final String MANAGE_CREDENTIAL_MANAGEMENT_APP = "android.permission"
+            + ".MANAGE_CREDENTIAL_MANAGEMENT_APP";
+    /** See {@code Manifest#UPDATE_FONTS} */
+    public static final String UPDATE_FONTS = "android.permission.UPDATE_FONTS";
+    /** See {@code Manifest#USE_ATTESTATION_VERIFICATION_SERVICE} */
+    public static final String USE_ATTESTATION_VERIFICATION_SERVICE =
+            "android.permission.USE_ATTESTATION_VERIFICATION_SERVICE";
+    /** See {@code Manifest#VERIFY_ATTESTATION} */
+    public static final String VERIFY_ATTESTATION = "android.permission.VERIFY_ATTESTATION";
+    /** See {@code Manifest#BIND_ATTESTATION_VERIFICATION_SERVICE} */
+    public static final String BIND_ATTESTATION_VERIFICATION_SERVICE = "android.permission"
+            + ".BIND_ATTESTATION_VERIFICATION_SERVICE";
+    /** See {@code Manifest#WRITE_SECURE_SETTINGS} */
+    public static final String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS";
+    /** See {@code Manifest#DUMP} */
+    public static final String DUMP = "android.permission.DUMP";
+    /** See {@code Manifest#CONTROL_UI_TRACING} */
+    public static final String CONTROL_UI_TRACING = "android.permission.CONTROL_UI_TRACING";
+    /** See {@code Manifest#READ_LOGS} */
+    public static final String READ_LOGS = "android.permission.READ_LOGS";
+    /** See {@code Manifest#SET_DEBUG_APP} */
+    public static final String SET_DEBUG_APP = "android.permission.SET_DEBUG_APP";
+    /** See {@code Manifest#SET_PROCESS_LIMIT} */
+    public static final String SET_PROCESS_LIMIT = "android.permission.SET_PROCESS_LIMIT";
+    /** See {@code Manifest#SET_ALWAYS_FINISH} */
+    public static final String SET_ALWAYS_FINISH = "android.permission.SET_ALWAYS_FINISH";
+    /** See {@code Manifest#SIGNAL_PERSISTENT_PROCESSES} */
+    public static final String SIGNAL_PERSISTENT_PROCESSES =
+            "android.permission.SIGNAL_PERSISTENT_PROCESSES";
+    /** See {@code Manifest#APPROVE_INCIDENT_REPORTS} */
+    public static final String APPROVE_INCIDENT_REPORTS =
+            "android.permission.APPROVE_INCIDENT_REPORTS";
+    /** See {@code Manifest#REQUEST_INCIDENT_REPORT_APPROVAL} */
+    public static final String REQUEST_INCIDENT_REPORT_APPROVAL = "android.permission"
+            + ".REQUEST_INCIDENT_REPORT_APPROVAL";
+    /** See {@code Manifest#GET_ACCOUNTS_PRIVILEGED} */
+    public static final String GET_ACCOUNTS_PRIVILEGED = "android.permission"
+            + ".GET_ACCOUNTS_PRIVILEGED";
+    /** See {@code Manifest#GET_PASSWORD} */
+    public static final String GET_PASSWORD = "android.permission.GET_PASSWORD";
+    /** See {@code Manifest#DIAGNOSTIC} */
+    public static final String DIAGNOSTIC = "android.permission.DIAGNOSTIC";
+    /** See {@code Manifest#STATUS_BAR} */
+    public static final String STATUS_BAR = "android.permission.STATUS_BAR";
+    /** See {@code Manifest#TRIGGER_SHELL_BUGREPORT} */
+    public static final String TRIGGER_SHELL_BUGREPORT = "android.permission"
+            + ".TRIGGER_SHELL_BUGREPORT";
+    /** See {@code Manifest#TRIGGER_SHELL_PROFCOLLECT_UPLOAD} */
+    public static final String TRIGGER_SHELL_PROFCOLLECT_UPLOAD = "android.permission"
+            + ".TRIGGER_SHELL_PROFCOLLECT_UPLOAD";
+    /** See {@code Manifest#STATUS_BAR_SERVICE} */
+    public static final String STATUS_BAR_SERVICE = "android.permission.STATUS_BAR_SERVICE";
+    /** See {@code Manifest#BIND_QUICK_SETTINGS_TILE} */
+    public static final String BIND_QUICK_SETTINGS_TILE =
+            "android.permission.BIND_QUICK_SETTINGS_TILE";
+    /** See {@code Manifest#BIND_CONTROLS} */
+    public static final String BIND_CONTROLS = "android.permission.BIND_CONTROLS";
+    /** See {@code Manifest#FORCE_BACK} */
+    public static final String FORCE_BACK = "android.permission.FORCE_BACK";
+    /** See {@code Manifest#UPDATE_DEVICE_STATS} */
+    public static final String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
+    /** See {@code Manifest#GET_APP_OPS_STATS} */
+    public static final String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
+    /** See {@code Manifest#GET_HISTORICAL_APP_OPS_STATS} */
+    public static final String GET_HISTORICAL_APP_OPS_STATS = "android.permission"
+            + ".GET_HISTORICAL_APP_OPS_STATS";
+    /** See {@code Manifest#UPDATE_APP_OPS_STATS} */
+    public static final String UPDATE_APP_OPS_STATS = "android.permission.UPDATE_APP_OPS_STATS";
+    /** See {@code Manifest#MANAGE_APP_OPS_RESTRICTIONS} */
+    public static final String MANAGE_APP_OPS_RESTRICTIONS = "android.permission"
+            + ".MANAGE_APP_OPS_RESTRICTIONS";
+    /** See {@code Manifest#MANAGE_APP_OPS_MODES} */
+    public static final String MANAGE_APP_OPS_MODES = "android.permission.MANAGE_APP_OPS_MODES";
+    /** See {@code Manifest#INTERNAL_SYSTEM_WINDOW} */
+    public static final String INTERNAL_SYSTEM_WINDOW = "android.permission"
+            + ".INTERNAL_SYSTEM_WINDOW";
+    /** See {@code Manifest#UNLIMITED_TOASTS} */
+    public static final String UNLIMITED_TOASTS = "android.permission.UNLIMITED_TOASTS";
+    /** See {@code Manifest#HIDE_NON_SYSTEM_OVERLAY_WINDOWS} */
+    public static final String HIDE_NON_SYSTEM_OVERLAY_WINDOWS =
+            "android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS";
+    /** See {@code Manifest#MANAGE_APP_TOKENS} */
+    public static final String MANAGE_APP_TOKENS = "android.permission.MANAGE_APP_TOKENS";
+    /** See {@code Manifest#REGISTER_WINDOW_MANAGER_LISTENERS} */
+    public static final String REGISTER_WINDOW_MANAGER_LISTENERS = "android.permission"
+            + ".REGISTER_WINDOW_MANAGER_LISTENERS";
+    /** See {@code Manifest#FREEZE_SCREEN} */
+    public static final String FREEZE_SCREEN = "android.permission.FREEZE_SCREEN";
+    /** See {@code Manifest#INJECT_EVENTS} */
+    public static final String INJECT_EVENTS = "android.permission.INJECT_EVENTS";
+    /** See {@code Manifest#FILTER_EVENTS} */
+    public static final String FILTER_EVENTS = "android.permission.FILTER_EVENTS";
+    /** See {@code Manifest#RETRIEVE_WINDOW_TOKEN} */
+    public static final String RETRIEVE_WINDOW_TOKEN = "android.permission.RETRIEVE_WINDOW_TOKEN";
+    /** See {@code Manifest#MODIFY_ACCESSIBILITY_DATA} */
+    public static final String MODIFY_ACCESSIBILITY_DATA =
+            "android.permission.MODIFY_ACCESSIBILITY_DATA";
+    /** See {@code Manifest#ACT_AS_PACKAGE_FOR_ACCESSIBILITY} */
+    public static final String ACT_AS_PACKAGE_FOR_ACCESSIBILITY = "android.permission"
+            + ".ACT_AS_PACKAGE_FOR_ACCESSIBILITY";
+    /** See {@code Manifest#CHANGE_ACCESSIBILITY_VOLUME} */
+    public static final String CHANGE_ACCESSIBILITY_VOLUME =
+            "android.permission.CHANGE_ACCESSIBILITY_VOLUME";
+    /** See {@code Manifest#FRAME_STATS} */
+    public static final String FRAME_STATS = "android.permission.FRAME_STATS";
+    /** See {@code Manifest#TEMPORARY_ENABLE_ACCESSIBILITY} */
+    public static final String TEMPORARY_ENABLE_ACCESSIBILITY = "android.permission"
+            + ".TEMPORARY_ENABLE_ACCESSIBILITY";
+    /** See {@code Manifest#OPEN_ACCESSIBILITY_DETAILS_SETTINGS} */
+    public static final String OPEN_ACCESSIBILITY_DETAILS_SETTINGS = "android.permission"
+            + ".OPEN_ACCESSIBILITY_DETAILS_SETTINGS";
+    /** See {@code Manifest#SET_ACTIVITY_WATCHER} */
+    public static final String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
+    /** See {@code Manifest#SHUTDOWN} */
+    public static final String SHUTDOWN = "android.permission.SHUTDOWN";
+    /** See {@code Manifest#STOP_APP_SWITCHES} */
+    public static final String STOP_APP_SWITCHES = "android.permission.STOP_APP_SWITCHES";
+    /** See {@code Manifest#GET_TOP_ACTIVITY_INFO} */
+    public static final String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO";
+    /** See {@code Manifest#READ_INPUT_STATE} */
+    public static final String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE";
+    /** See {@code Manifest#BIND_INPUT_METHOD} */
+    public static final String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD";
+    /** See {@code Manifest#BIND_MIDI_DEVICE_SERVICE} */
+    public static final String BIND_MIDI_DEVICE_SERVICE = "android.permission"
+            + ".BIND_MIDI_DEVICE_SERVICE";
+    /** See {@code Manifest#BIND_ACCESSIBILITY_SERVICE} */
+    public static final String BIND_ACCESSIBILITY_SERVICE =
+            "android.permission.BIND_ACCESSIBILITY_SERVICE";
+    /** See {@code Manifest#BIND_PRINT_SERVICE} */
+    public static final String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE";
+    /** See {@code Manifest#BIND_PRINT_RECOMMENDATION_SERVICE} */
+    public static final String BIND_PRINT_RECOMMENDATION_SERVICE = "android.permission.BIND_PRINT_RECOMMENDATION_SERVICE";
+    /** See {@code Manifest#READ_PRINT_SERVICES} */
+    public static final String READ_PRINT_SERVICES = "android.permission.READ_PRINT_SERVICES";
+    /** See {@code Manifest#READ_PRINT_SERVICE_RECOMMENDATIONS} */
+    public static final String READ_PRINT_SERVICE_RECOMMENDATIONS = "android.permission"
+            + ".READ_PRINT_SERVICE_RECOMMENDATIONS";
+    /** See {@code Manifest#BIND_NFC_SERVICE} */
+    public static final String BIND_NFC_SERVICE = "android.permission.BIND_NFC_SERVICE";
+    /** See {@code Manifest#BIND_QUICK_ACCESS_WALLET_SERVICE} */
+    public static final String BIND_QUICK_ACCESS_WALLET_SERVICE =
+            "android.permission.BIND_QUICK_ACCESS_WALLET_SERVICE";
+    /** See {@code Manifest#BIND_PRINT_SPOOLER_SERVICE} */
+    public static final String BIND_PRINT_SPOOLER_SERVICE = "android.permission"
+            + ".BIND_PRINT_SPOOLER_SERVICE";
+    /** See {@code Manifest#BIND_COMPANION_DEVICE_MANAGER_SERVICE} */
+    public static final String BIND_COMPANION_DEVICE_MANAGER_SERVICE =
+            "android.permission.BIND_COMPANION_DEVICE_MANAGER_SERVICE";
+    /** See {@code Manifest#BIND_COMPANION_DEVICE_SERVICE} */
+    public static final String BIND_COMPANION_DEVICE_SERVICE = "android.permission"
+            + ".BIND_COMPANION_DEVICE_SERVICE";
+    /** See {@code Manifest#BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE} */
+    public static final String BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE = "android.permission"
+            + ".BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE";
+    /** See {@code Manifest#BIND_TEXT_SERVICE} */
+    public static final String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE";
+    /** See {@code Manifest#BIND_ATTENTION_SERVICE} */
+    public static final String BIND_ATTENTION_SERVICE = "android.permission"
+            + ".BIND_ATTENTION_SERVICE";
+    /** See {@code Manifest#BIND_ROTATION_RESOLVER_SERVICE} */
+    public static final String BIND_ROTATION_RESOLVER_SERVICE = "android.permission"
+            + ".BIND_ROTATION_RESOLVER_SERVICE";
+    /** See {@code Manifest#BIND_VPN_SERVICE} */
+    public static final String BIND_VPN_SERVICE = "android.permission.BIND_VPN_SERVICE";
+    /** See {@code Manifest#BIND_WALLPAPER} */
+    public static final String BIND_WALLPAPER = "android.permission.BIND_WALLPAPER";
+    /** See {@code Manifest#BIND_GAME_SERVICE} */
+    public static final String BIND_GAME_SERVICE = "android.permission.BIND_GAME_SERVICE";
+    /** See {@code Manifest#BIND_VOICE_INTERACTION} */
+    public static final String BIND_VOICE_INTERACTION = "android.permission"
+            + ".BIND_VOICE_INTERACTION";
+    /** See {@code Manifest#BIND_HOTWORD_DETECTION_SERVICE} */
+    public static final String BIND_HOTWORD_DETECTION_SERVICE = "android.permission"
+            + ".BIND_HOTWORD_DETECTION_SERVICE";
+    /** See {@code Manifest#MANAGE_HOTWORD_DETECTION} */
+    public static final String MANAGE_HOTWORD_DETECTION = "android.permission"
+            + ".MANAGE_HOTWORD_DETECTION";
+    /** See {@code Manifest#BIND_AUTOFILL_SERVICE} */
+    public static final String BIND_AUTOFILL_SERVICE = "android.permission.BIND_AUTOFILL_SERVICE";
+    /** See {@code Manifest#BIND_AUTOFILL} */
+    public static final String BIND_AUTOFILL = "android.permission.BIND_AUTOFILL";
+    /** See {@code Manifest#BIND_AUTOFILL_FIELD_CLASSIFICATION_SERVICE} */
+    public static final String BIND_AUTOFILL_FIELD_CLASSIFICATION_SERVICE = "android.permission"
+            + ".BIND_AUTOFILL_FIELD_CLASSIFICATION_SERVICE";
+    /** See {@code Manifest#BIND_INLINE_SUGGESTION_RENDER_SERVICE} */
+    public static final String BIND_INLINE_SUGGESTION_RENDER_SERVICE =
+            "android.permission.BIND_INLINE_SUGGESTION_RENDER_SERVICE";
+    /** See {@code Manifest#BIND_TEXTCLASSIFIER_SERVICE} */
+    public static final String BIND_TEXTCLASSIFIER_SERVICE =
+            "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
+    /** See {@code Manifest#BIND_CONTENT_CAPTURE_SERVICE} */
+    public static final String BIND_CONTENT_CAPTURE_SERVICE = "android.permission"
+            + ".BIND_CONTENT_CAPTURE_SERVICE";
+    /** See {@code Manifest#BIND_TRANSLATION_SERVICE} */
+    public static final String BIND_TRANSLATION_SERVICE =
+            "android.permission.BIND_TRANSLATION_SERVICE";
+    /** See {@code Manifest#MANAGE_UI_TRANSLATION} */
+    public static final String MANAGE_UI_TRANSLATION =  "android.permission.MANAGE_UI_TRANSLATION";
+    /** See {@code Manifest#BIND_CONTENT_SUGGESTIONS_SERVICE} */
+    public static final String BIND_CONTENT_SUGGESTIONS_SERVICE = "android.permission"
+            + ".BIND_CONTENT_SUGGESTIONS_SERVICE";
+    /** See {@code Manifest#BIND_MUSIC_RECOGNITION_SERVICE} */
+    public static final String BIND_MUSIC_RECOGNITION_SERVICE =
+            "android.permission.BIND_MUSIC_RECOGNITION_SERVICE";
+    /** See {@code Manifest#BIND_AUGMENTED_AUTOFILL_SERVICE} */
+    public static final String BIND_AUGMENTED_AUTOFILL_SERVICE = "android.permission"
+            + ".BIND_AUGMENTED_AUTOFILL_SERVICE";
+    /** See {@code Manifest#MANAGE_VOICE_KEYPHRASES} */
+    public static final String MANAGE_VOICE_KEYPHRASES = "android.permission"
+            + ".MANAGE_VOICE_KEYPHRASES";
+    /** See {@code Manifest#KEYPHRASE_ENROLLMENT_APPLICATION} */
+    public static final String KEYPHRASE_ENROLLMENT_APPLICATION =
+            "android.permission.KEYPHRASE_ENROLLMENT_APPLICATION";
+    /** See {@code Manifest#BIND_REMOTE_DISPLAY} */
+    public static final String BIND_REMOTE_DISPLAY = "android.permission.BIND_REMOTE_DISPLAY";
+    /** See {@code Manifest#BIND_TV_INPUT} */
+    public static final String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT";
+    /** See {@code Manifest#BIND_TV_REMOTE_SERVICE} */
+    public static final String BIND_TV_REMOTE_SERVICE = "android.permission"
+            + ".BIND_TV_REMOTE_SERVICE";
+    /** See {@code Manifest#TV_VIRTUAL_REMOTE_CONTROLLER} */
+    public static final String TV_VIRTUAL_REMOTE_CONTROLLER = "android.permission"
+            + ".TV_VIRTUAL_REMOTE_CONTROLLER";
+    /** See {@code Manifest#CHANGE_HDMI_CEC_ACTIVE_SOURCE} */
+    public static final String CHANGE_HDMI_CEC_ACTIVE_SOURCE = "android.permission"
+            + ".CHANGE_HDMI_CEC_ACTIVE_SOURCE";
+    /** See {@code Manifest#MODIFY_PARENTAL_CONTROLS} */
+    public static final String MODIFY_PARENTAL_CONTROLS = "android.permission"
+            + ".MODIFY_PARENTAL_CONTROLS";
+    /** See {@code Manifest#READ_CONTENT_RATING_SYSTEMS} */
+    public static final String READ_CONTENT_RATING_SYSTEMS = "android.permission"
+            + ".READ_CONTENT_RATING_SYSTEMS";
+    /** See {@code Manifest#NOTIFY_TV_INPUTS} */
+    public static final String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";
+    /** See {@code Manifest#TUNER_RESOURCE_ACCESS} */
+    public static final String TUNER_RESOURCE_ACCESS = "android.permission.TUNER_RESOURCE_ACCESS";
+    /** See {@code Manifest#MEDIA_RESOURCE_OVERRIDE_PID} */
+    public static final String MEDIA_RESOURCE_OVERRIDE_PID = "android.permission"
+            + ".MEDIA_RESOURCE_OVERRIDE_PID";
+    /** See {@code Manifest#REGISTER_MEDIA_RESOURCE_OBSERVER} */
+    public static final String REGISTER_MEDIA_RESOURCE_OBSERVER = "android.permission"
+            + ".REGISTER_MEDIA_RESOURCE_OBSERVER";
+    /** See {@code Manifest#BIND_ROUTE_PROVIDER} */
+    public static final String BIND_ROUTE_PROVIDER = "android.permission.BIND_ROUTE_PROVIDER";
+    /** See {@code Manifest#BIND_DEVICE_ADMIN} */
+    public static final String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN";
+    /** See {@code Manifest#MANAGE_DEVICE_ADMINS} */
+    public static final String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS";
+    /** See {@code Manifest#RESET_PASSWORD} */
+    public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD";
+    /** See {@code Manifest#LOCK_DEVICE} */
+    public static final String LOCK_DEVICE = "android.permission.LOCK_DEVICE";
+    /** See {@code Manifest#SET_ORIENTATION} */
+    public static final String SET_ORIENTATION = "android.permission.SET_ORIENTATION";
+    /** See {@code Manifest#SET_POINTER_SPEED} */
+    public static final String SET_POINTER_SPEED = "android.permission.SET_POINTER_SPEED";
+    /** See {@code Manifest#SET_INPUT_CALIBRATION} */
+    public static final String SET_INPUT_CALIBRATION = "android.permission.SET_INPUT_CALIBRATION";
+    /** See {@code Manifest#SET_KEYBOARD_LAYOUT} */
+    public static final String SET_KEYBOARD_LAYOUT = "android.permission.SET_KEYBOARD_LAYOUT";
+    /** See {@code Manifest#SCHEDULE_PRIORITIZED_ALARM} */
+    public static final String SCHEDULE_PRIORITIZED_ALARM =
+            "android.permission.SCHEDULE_PRIORITIZED_ALARM";
+    /** See {@code Manifest#SCHEDULE_EXACT_ALARM} */
+    public static final String SCHEDULE_EXACT_ALARM = "android.permission.SCHEDULE_EXACT_ALARM";
+    /** See {@code Manifest#TABLET_MODE} */
+    public static final String TABLET_MODE = "android.permission.TABLET_MODE";
+    /** See {@code Manifest#REQUEST_INSTALL_PACKAGES} */
+    public static final String REQUEST_INSTALL_PACKAGES = "android.permission"
+            + ".REQUEST_INSTALL_PACKAGES";
+    /** See {@code Manifest#REQUEST_DELETE_PACKAGES} */
+    public static final String REQUEST_DELETE_PACKAGES = "android.permission"
+            + ".REQUEST_DELETE_PACKAGES";
+    /** See {@code Manifest#INSTALL_PACKAGES} */
+    public static final String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES";
+    /** See {@code Manifest#INSTALL_SELF_UPDATES} */
+    public static final String INSTALL_SELF_UPDATES = "android.permission.INSTALL_SELF_UPDATES";
+    /** See {@code Manifest#INSTALL_PACKAGE_UPDATES} */
+    public static final String INSTALL_PACKAGE_UPDATES = "android.permission"
+            + ".INSTALL_PACKAGE_UPDATES";
+    /** See {@code Manifest#INSTALL_EXISTING_PACKAGES} */
+    public static final String INSTALL_EXISTING_PACKAGES = "com.android.permission"
+            + ".INSTALL_EXISTING_PACKAGES";
+    /** See {@code Manifest#USE_INSTALLER_V2} */
+    public static final String USE_INSTALLER_V2 = "com.android.permission.USE_INSTALLER_V2";
+    /** See {@code Manifest#INSTALL_TEST_ONLY_PACKAGE} */
+    public static final String INSTALL_TEST_ONLY_PACKAGE = "android.permission"
+            + ".INSTALL_TEST_ONLY_PACKAGE";
+    /** See {@code Manifest#INSTALL_DPC_PACKAGES} */
+    public static final String INSTALL_DPC_PACKAGES = "android.permission.INSTALL_DPC_PACKAGES";
+    /** See {@code Manifest#USE_SYSTEM_DATA_LOADERS} */
+    public static final String USE_SYSTEM_DATA_LOADERS = "com.android.permission"
+            + ".USE_SYSTEM_DATA_LOADERS";
+    /** See {@code Manifest#CLEAR_APP_USER_DATA} */
+    public static final String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA";
+    /** See {@code Manifest#GET_APP_GRANTED_URI_PERMISSIONS} */
+    public static final String GET_APP_GRANTED_URI_PERMISSIONS = "android.permission"
+            + ".GET_APP_GRANTED_URI_PERMISSIONS";
+    /** See {@code Manifest#CLEAR_APP_GRANTED_URI_PERMISSIONS} */
+    public static final String CLEAR_APP_GRANTED_URI_PERMISSIONS =
+            "android.permission.CLEAR_APP_GRANTED_URI_PERMISSIONS";
+    /** See {@code Manifest#MANAGE_SCOPED_ACCESS_DIRECTORY_PERMISSIONS} */
+    public static final String MANAGE_SCOPED_ACCESS_DIRECTORY_PERMISSIONS =
+            "android.permission.MANAGE_SCOPED_ACCESS_DIRECTORY_PERMISSIONS";
+    /** See {@code Manifest#FORCE_PERSISTABLE_URI_PERMISSIONS} */
+    public static final String FORCE_PERSISTABLE_URI_PERMISSIONS = "android.permission"
+            + ".FORCE_PERSISTABLE_URI_PERMISSIONS";
+    /** See {@code Manifest#DELETE_CACHE_FILES} */
+    public static final String DELETE_CACHE_FILES = "android.permission.DELETE_CACHE_FILES";
+    /** See {@code Manifest#INTERNAL_DELETE_CACHE_FILES} */
+    public static final String INTERNAL_DELETE_CACHE_FILES =
+            "android.permission.INTERNAL_DELETE_CACHE_FILES";
+    /** See {@code Manifest#DELETE_PACKAGES} */
+    public static final String DELETE_PACKAGES = "android.permission.DELETE_PACKAGES";
+    /** See {@code Manifest#MOVE_PACKAGE} */
+    public static final String MOVE_PACKAGE = "android.permission.MOVE_PACKAGE";
+    /** See {@code Manifest#KEEP_UNINSTALLED_PACKAGES} */
+    public static final String KEEP_UNINSTALLED_PACKAGES =
+            "android.permission.KEEP_UNINSTALLED_PACKAGES";
+    /** See {@code Manifest#CHANGE_COMPONENT_ENABLED_STATE} */
+    public static final String CHANGE_COMPONENT_ENABLED_STATE =
+            "android.permission.CHANGE_COMPONENT_ENABLED_STATE";
+    /** See {@code Manifest#GRANT_RUNTIME_PERMISSIONS} */
+    public static final String GRANT_RUNTIME_PERMISSIONS =
+            "android.permission.GRANT_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#INSTALL_GRANT_RUNTIME_PERMISSIONS} */
+    public static final String INSTALL_GRANT_RUNTIME_PERMISSIONS = "android.permission"
+            + ".INSTALL_GRANT_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#REVOKE_RUNTIME_PERMISSIONS} */
+    public static final String REVOKE_RUNTIME_PERMISSIONS = "android.permission"
+            + ".REVOKE_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#GET_RUNTIME_PERMISSIONS} */
+    public static final String GET_RUNTIME_PERMISSIONS = "android.permission"
+            + ".GET_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#RESTORE_RUNTIME_PERMISSIONS} */
+    public static final String RESTORE_RUNTIME_PERMISSIONS = "android.permission"
+            + ".RESTORE_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#ADJUST_RUNTIME_PERMISSIONS_POLICY} */
+    public static final String ADJUST_RUNTIME_PERMISSIONS_POLICY = "android.permission"
+            + ".ADJUST_RUNTIME_PERMISSIONS_POLICY";
+    /** See {@code Manifest#UPGRADE_RUNTIME_PERMISSIONS} */
+    public static final String UPGRADE_RUNTIME_PERMISSIONS =
+            "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
+    /** See {@code Manifest#WHITELIST_RESTRICTED_PERMISSIONS} */
+    public static final String WHITELIST_RESTRICTED_PERMISSIONS = "android.permission"
+            + ".WHITELIST_RESTRICTED_PERMISSIONS";
+    /** See {@code Manifest#WHITELIST_AUTO_REVOKE_PERMISSIONS} */
+    public static final String WHITELIST_AUTO_REVOKE_PERMISSIONS = "android.permission"
+            + ".WHITELIST_AUTO_REVOKE_PERMISSIONS";
+    /** See {@code Manifest#OBSERVE_GRANT_REVOKE_PERMISSIONS} */
+    public static final String OBSERVE_GRANT_REVOKE_PERMISSIONS =
+            "android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS";
+    /** See {@code Manifest#MANAGE_ONE_TIME_PERMISSION_SESSIONS} */
+    public static final String MANAGE_ONE_TIME_PERMISSION_SESSIONS =
+            "android.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS";
+    /** See {@code Manifest#MANAGE_ROLE_HOLDERS} */
+    public static final String MANAGE_ROLE_HOLDERS = "android.permission.MANAGE_ROLE_HOLDERS";
+    /** See {@code Manifest#BYPASS_ROLE_QUALIFICATION} */
+    public static final String BYPASS_ROLE_QUALIFICATION = "android.permission"
+            + ".BYPASS_ROLE_QUALIFICATION";
+    /** See {@code Manifest#OBSERVE_ROLE_HOLDERS} */
+    public static final String OBSERVE_ROLE_HOLDERS = "android.permission.OBSERVE_ROLE_HOLDERS";
+    /** See {@code Manifest#MANAGE_COMPANION_DEVICES} */
+    public static final String MANAGE_COMPANION_DEVICES =
+            "android.permission.MANAGE_COMPANION_DEVICES";
+    /** See {@code Manifest#REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE} */
+    public static final String REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE =
+            "android.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE";
+    /** See {@code Manifest#DELIVER_COMPANION_MESSAGES} */
+    public static final String DELIVER_COMPANION_MESSAGES = "android.permission"
+            + ".DELIVER_COMPANION_MESSAGES";
+    /** See {@code Manifest#ACCESS_SURFACE_FLINGER} */
+    public static final String ACCESS_SURFACE_FLINGER = "android.permission.ACCESS_SURFACE_FLINGER";
+    /** See {@code Manifest#ROTATE_SURFACE_FLINGER} */
+    public static final String ROTATE_SURFACE_FLINGER = "android.permission"
+            + ".ROTATE_SURFACE_FLINGER";
+    /** See {@code Manifest#READ_FRAME_BUFFER} */
+    public static final String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER";
+    /** See {@code Manifest#ACCESS_INPUT_FLINGER} */
+    public static final String ACCESS_INPUT_FLINGER = "android.permission.ACCESS_INPUT_FLINGER";
+    /** See {@code Manifest#DISABLE_INPUT_DEVICE} */
+    public static final String DISABLE_INPUT_DEVICE = "android.permission.DISABLE_INPUT_DEVICE";
+    /** See {@code Manifest#CONFIGURE_WIFI_DISPLAY} */
+    public static final String CONFIGURE_WIFI_DISPLAY =
+            "android.permission.CONFIGURE_WIFI_DISPLAY";
+    /** See {@code Manifest#CONTROL_WIFI_DISPLAY} */
+    public static final String CONTROL_WIFI_DISPLAY = "android.permission.CONTROL_WIFI_DISPLAY";
+    /** See {@code Manifest#CONFIGURE_DISPLAY_COLOR_MODE} */
+    public static final String CONFIGURE_DISPLAY_COLOR_MODE =
+            "android.permission.CONFIGURE_DISPLAY_COLOR_MODE";
+    /** See {@code Manifest#CONTROL_DEVICE_LIGHTS} */
+    public static final String CONTROL_DEVICE_LIGHTS = "android.permission.CONTROL_DEVICE_LIGHTS";
+    /** See {@code Manifest#CONTROL_DISPLAY_SATURATION} */
+    public static final String CONTROL_DISPLAY_SATURATION = "android.permission"
+            + ".CONTROL_DISPLAY_SATURATION";
+    /** See {@code Manifest#CONTROL_DISPLAY_COLOR_TRANSFORMS} */
+    public static final String CONTROL_DISPLAY_COLOR_TRANSFORMS =
+            "android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS";
+    /** See {@code Manifest#BRIGHTNESS_SLIDER_USAGE} */
+    public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission"
+            + ".BRIGHTNESS_SLIDER_USAGE";
+    /** See {@code Manifest#ACCESS_AMBIENT_LIGHT_STATS} */
+    public static final String ACCESS_AMBIENT_LIGHT_STATS =
+            "android.permission.ACCESS_AMBIENT_LIGHT_STATS";
+    /** See {@code Manifest#CONFIGURE_DISPLAY_BRIGHTNESS} */
+    public static final String CONFIGURE_DISPLAY_BRIGHTNESS =
+            "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
+    /** See {@code Manifest#CONTROL_DISPLAY_BRIGHTNESS} */
+    public static final String CONTROL_DISPLAY_BRIGHTNESS = "android.permission"
+            + ".CONTROL_DISPLAY_BRIGHTNESS";
+    /** See {@code Manifest#OVERRIDE_DISPLAY_MODE_REQUESTS} */
+    public static final String OVERRIDE_DISPLAY_MODE_REQUESTS = "android.permission"
+            + ".OVERRIDE_DISPLAY_MODE_REQUESTS";
+    /** See {@code Manifest#MODIFY_REFRESH_RATE_SWITCHING_TYPE} */
+    public static final String MODIFY_REFRESH_RATE_SWITCHING_TYPE =
+            "android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE";
+    /** See {@code Manifest#CONTROL_VPN} */
+    public static final String CONTROL_VPN = "android.permission.CONTROL_VPN";
+    /** See {@code Manifest#CONTROL_ALWAYS_ON_VPN} */
+    public static final String CONTROL_ALWAYS_ON_VPN = "android.permission.CONTROL_ALWAYS_ON_VPN";
+    /** See {@code Manifest#CAPTURE_TUNER_AUDIO_INPUT} */
+    public static final String CAPTURE_TUNER_AUDIO_INPUT =
+            "android.permission.CAPTURE_TUNER_AUDIO_INPUT";
+    /** See {@code Manifest#CAPTURE_AUDIO_OUTPUT} */
+    public static final String CAPTURE_AUDIO_OUTPUT = "android.permission.CAPTURE_AUDIO_OUTPUT";
+    /** See {@code Manifest#CAPTURE_MEDIA_OUTPUT} */
+    public static final String CAPTURE_MEDIA_OUTPUT = "android.permission.CAPTURE_MEDIA_OUTPUT";
+    /** See {@code Manifest#CAPTURE_VOICE_COMMUNICATION_OUTPUT} */
+    public static final String CAPTURE_VOICE_COMMUNICATION_OUTPUT = "android.permission"
+            + ".CAPTURE_VOICE_COMMUNICATION_OUTPUT";
+    /** See {@code Manifest#CAPTURE_AUDIO_HOTWORD} */
+    public static final String CAPTURE_AUDIO_HOTWORD = "android.permission.CAPTURE_AUDIO_HOTWORD";
+    /** See {@code Manifest#SOUNDTRIGGER_DELEGATE_IDENTITY} */
+    public static final String SOUNDTRIGGER_DELEGATE_IDENTITY =
+            "android.permission.SOUNDTRIGGER_DELEGATE_IDENTITY";
+    /** See {@code Manifest#MODIFY_AUDIO_ROUTING} */
+    public static final String MODIFY_AUDIO_ROUTING = "android.permission.MODIFY_AUDIO_ROUTING";
+    /** See {@code Manifest#CALL_AUDIO_INTERCEPTION} */
+    public static final String CALL_AUDIO_INTERCEPTION =
+            "android.permission.CALL_AUDIO_INTERCEPTION";
+    /** See {@code Manifest#QUERY_AUDIO_STATE} */
+    public static final String QUERY_AUDIO_STATE = "android.permission.QUERY_AUDIO_STATE";
+    /** See {@code Manifest#MODIFY_DEFAULT_AUDIO_EFFECTS} */
+    public static final String MODIFY_DEFAULT_AUDIO_EFFECTS = "android.permission"
+            + ".MODIFY_DEFAULT_AUDIO_EFFECTS";
+    /** See {@code Manifest#DISABLE_SYSTEM_SOUND_EFFECTS} */
+    public static final String DISABLE_SYSTEM_SOUND_EFFECTS = "android.permission"
+            + ".DISABLE_SYSTEM_SOUND_EFFECTS";
+    /** See {@code Manifest#REMOTE_DISPLAY_PROVIDER} */
+    public static final String REMOTE_DISPLAY_PROVIDER =
+            "android.permission.REMOTE_DISPLAY_PROVIDER";
+    /** See {@code Manifest#CAPTURE_SECURE_VIDEO_OUTPUT} */
+    public static final String CAPTURE_SECURE_VIDEO_OUTPUT =
+            "android.permission.CAPTURE_SECURE_VIDEO_OUTPUT";
+    /** See {@code Manifest#MEDIA_CONTENT_CONTROL} */
+    public static final String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
+    /** See {@code Manifest#SET_VOLUME_KEY_LONG_PRESS_LISTENER} */
+    public static final String SET_VOLUME_KEY_LONG_PRESS_LISTENER =
+            "android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER";
+    /** See {@code Manifest#SET_MEDIA_KEY_LISTENER} */
+    public static final String SET_MEDIA_KEY_LISTENER = "android.permission"
+            + ".SET_MEDIA_KEY_LISTENER";
+    /** See {@code Manifest#BRICK} */
+    public static final String BRICK = "android.permission.BRICK";
+    /** See {@code Manifest#REBOOT} */
+    public static final String REBOOT = "android.permission.REBOOT";
+    /** See {@code Manifest#DEVICE_POWER} */
+    public static final String DEVICE_POWER = "android.permission.DEVICE_POWER";
+    /** See {@code Manifest#POWER_SAVER} */
+    public static final String POWER_SAVER = "android.permission.POWER_SAVER";
+    /** See {@code Manifest#BATTERY_PREDICTION} */
+    public static final String BATTERY_PREDICTION = "android.permission.BATTERY_PREDICTION";
+    /** See {@code Manifest#USER_ACTIVITY} */
+    public static final String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
+    /** See {@code Manifest#NET_TUNNELING} */
+    public static final String NET_TUNNELING = "android.permission.NET_TUNNELING";
+    /** See {@code Manifest#FACTORY_TEST} */
+    public static final String FACTORY_TEST = "android.permission.FACTORY_TEST";
+    /** See {@code Manifest#BROADCAST_CLOSE_SYSTEM_DIALOGS} */
+    public static final String BROADCAST_CLOSE_SYSTEM_DIALOGS =
+            "android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS";
+    /** See {@code Manifest#BROADCAST_PACKAGE_REMOVED} */
+    public static final String BROADCAST_PACKAGE_REMOVED =
+            "android.permission.BROADCAST_PACKAGE_REMOVED";
+    /** See {@code Manifest#BROADCAST_SMS} */
+    public static final String BROADCAST_SMS = "android.permission.BROADCAST_SMS";
+    /** See {@code Manifest#BROADCAST_WAP_PUSH} */
+    public static final String BROADCAST_WAP_PUSH = "android.permission.BROADCAST_WAP_PUSH";
+    /** See {@code Manifest#BROADCAST_NETWORK_PRIVILEGED} */
+    public static final String BROADCAST_NETWORK_PRIVILEGED = "android.permission"
+            + ".BROADCAST_NETWORK_PRIVILEGED";
+    /** See {@code Manifest#MASTER_CLEAR} */
+    public static final String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
+    /** See {@code Manifest#CALL_PRIVILEGED} */
+    public static final String CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED";
+    /** See {@code Manifest#PERFORM_CDMA_PROVISIONING} */
+    public static final String PERFORM_CDMA_PROVISIONING =
+            "android.permission.PERFORM_CDMA_PROVISIONING";
+    /** See {@code Manifest#PERFORM_SIM_ACTIVATION} */
+    public static final String PERFORM_SIM_ACTIVATION = "android.permission.PERFORM_SIM_ACTIVATION";
+    /** See {@code Manifest#CONTROL_LOCATION_UPDATES} */
+    public static final String CONTROL_LOCATION_UPDATES =
+            "android.permission.CONTROL_LOCATION_UPDATES";
+    /** See {@code Manifest#ACCESS_CHECKIN_PROPERTIES} */
+    public static final String ACCESS_CHECKIN_PROPERTIES = "android.permission"
+            + ".ACCESS_CHECKIN_PROPERTIES";
+    /** See {@code Manifest#PACKAGE_USAGE_STATS} */
+    public static final String PACKAGE_USAGE_STATS = "android.permission.PACKAGE_USAGE_STATS";
+    /** See {@code Manifest#LOADER_USAGE_STATS} */
+    public static final String LOADER_USAGE_STATS = "android.permission.LOADER_USAGE_STATS";
+    /** See {@code Manifest#OBSERVE_APP_USAGE} */
+    public static final String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE";
+    /** See {@code Manifest#CHANGE_APP_IDLE_STATE} */
+    public static final String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
+    /** See {@code Manifest#CHANGE_APP_LAUNCH_TIME_ESTIMATE} */
+    public static final String CHANGE_APP_LAUNCH_TIME_ESTIMATE =
+            "android.permission.CHANGE_APP_LAUNCH_TIME_ESTIMATE";
+    /** See {@code Manifest#CHANGE_DEVICE_IDLE_TEMP_WHITELIST} */
+    public static final String CHANGE_DEVICE_IDLE_TEMP_WHITELIST =
+            "android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST";
+    /** See {@code Manifest#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} */
+    public static final String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS =
+            "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
+    /** See {@code Manifest#BATTERY_STATS} */
+    public static final String BATTERY_STATS = "android.permission.BATTERY_STATS";
+    /** See {@code Manifest#STATSCOMPANION} */
+    public static final String STATSCOMPANION = "android.permission.STATSCOMPANION";
+    /** See {@code Manifest#REGISTER_STATS_PULL_ATOM} */
+    public static final String REGISTER_STATS_PULL_ATOM = "android.permission"
+            + ".REGISTER_STATS_PULL_ATOM";
+    /** See {@code Manifest#BACKUP} */
+    public static final String BACKUP = "android.permission.BACKUP";
+    /** See {@code Manifest#MODIFY_SETTINGS_OVERRIDEABLE_BY_RESTORE} */
+    public static final String MODIFY_SETTINGS_OVERRIDEABLE_BY_RESTORE = "android.permission"
+            + ".MODIFY_SETTINGS_OVERRIDEABLE_BY_RESTORE";
+    /** See {@code Manifest#RECOVER_KEYSTORE} */
+    public static final String RECOVER_KEYSTORE = "android.permission.RECOVER_KEYSTORE";
+    /** See {@code Manifest#CONFIRM_FULL_BACKUP} */
+    public static final String CONFIRM_FULL_BACKUP = "android.permission.CONFIRM_FULL_BACKUP";
+    /** See {@code Manifest#BIND_REMOTEVIEWS} */
+    public static final String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
+    /** See {@code Manifest#BIND_APPWIDGET} */
+    public static final String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
+    /** See {@code Manifest#MANAGE_SLICE_PERMISSIONS} */
+    public static final String MANAGE_SLICE_PERMISSIONS =
+            "android.permission.MANAGE_SLICE_PERMISSIONS";
+    /** See {@code Manifest#BIND_KEYGUARD_APPWIDGET} */
+    public static final String BIND_KEYGUARD_APPWIDGET = "android.permission"
+            + ".BIND_KEYGUARD_APPWIDGET";
+    /** See {@code Manifest#MODIFY_APPWIDGET_BIND_PERMISSIONS} */
+    public static final String MODIFY_APPWIDGET_BIND_PERMISSIONS =
+            "android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS";
+    /** See {@code Manifest#CHANGE_BACKGROUND_DATA_SETTING} */
+    public static final String CHANGE_BACKGROUND_DATA_SETTING =
+            "android.permission.CHANGE_BACKGROUND_DATA_SETTING";
+    /** See {@code Manifest#GLOBAL_SEARCH} */
+    public static final String GLOBAL_SEARCH = "android.permission.GLOBAL_SEARCH";
+    /** See {@code Manifest#GLOBAL_SEARCH_CONTROL} */
+    public static final String GLOBAL_SEARCH_CONTROL = "android.permission.GLOBAL_SEARCH_CONTROL";
+    /** See {@code Manifest#READ_SEARCH_INDEXABLES} */
+    public static final String READ_SEARCH_INDEXABLES = "android.permission"
+            + ".READ_SEARCH_INDEXABLES";
+    /** See {@code Manifest#BIND_SETTINGS_SUGGESTIONS_SERVICE} */
+    public static final String BIND_SETTINGS_SUGGESTIONS_SERVICE = "android.permission"
+            + ".BIND_SETTINGS_SUGGESTIONS_SERVICE";
+    /** See {@code Manifest#WRITE_SETTINGS_HOMEPAGE_DATA} */
+    public static final String WRITE_SETTINGS_HOMEPAGE_DATA = "android.permission"
+            + ".WRITE_SETTINGS_HOMEPAGE_DATA";
+    /** See {@code Manifest#LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK} */
+    public static final String LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK = "android.permission"
+            + ".LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK";
+    /** See {@code Manifest#ALLOW_PLACE_IN_MULTI_PANE_SETTINGS} */
+    public static final String ALLOW_PLACE_IN_MULTI_PANE_SETTINGS =
+            "android.permission.ALLOW_PLACE_IN_MULTI_PANE_SETTINGS";
+    /** See {@code Manifest#SET_WALLPAPER_COMPONENT} */
+    public static final String SET_WALLPAPER_COMPONENT = "android.permission"
+            + ".SET_WALLPAPER_COMPONENT";
+    /** See {@code Manifest#READ_DREAM_STATE} */
+    public static final String READ_DREAM_STATE = "android.permission.READ_DREAM_STATE";
+    /** See {@code Manifest#WRITE_DREAM_STATE} */
+    public static final String WRITE_DREAM_STATE = "android.permission.WRITE_DREAM_STATE";
+    /** See {@code Manifest#READ_DREAM_SUPPRESSION} */
+    public static final String READ_DREAM_SUPPRESSION = "android.permission"
+            + ".READ_DREAM_SUPPRESSION";
+    /** See {@code Manifest#ACCESS_CACHE_FILESYSTEM} */
+    public static final String ACCESS_CACHE_FILESYSTEM = "android.permission"
+            + ".ACCESS_CACHE_FILESYSTEM";
+    /** See {@code Manifest#COPY_PROTECTED_DATA} */
+    public static final String COPY_PROTECTED_DATA = "android.permission.COPY_PROTECTED_DATA";
+    /** See {@code Manifest#CRYPT_KEEPER} */
+    public static final String CRYPT_KEEPER = "android.permission.CRYPT_KEEPER";
+    /** See {@code Manifest#READ_NETWORK_USAGE_HISTORY} */
+    public static final String READ_NETWORK_USAGE_HISTORY =
+            "android.permission.READ_NETWORK_USAGE_HISTORY";
+    /** See {@code Manifest#MANAGE_NETWORK_POLICY} */
+    public static final String MANAGE_NETWORK_POLICY = "android.permission.MANAGE_NETWORK_POLICY";
+    /** See {@code Manifest#MODIFY_NETWORK_ACCOUNTING} */
+    public static final String MODIFY_NETWORK_ACCOUNTING =
+            "android.permission.MODIFY_NETWORK_ACCOUNTING";
+    /** See {@code Manifest#MANAGE_SUBSCRIPTION_PLANS} */
+    public static final String MANAGE_SUBSCRIPTION_PLANS = "android.permission"
+            + ".MANAGE_SUBSCRIPTION_PLANS";
+    /** See {@code Manifest#C2D_MESSAGE} */
+    public static final String C2D_MESSAGE = "android.intent.category.MASTER_CLEAR.permission"
+            + ".C2D_MESSAGE";
+    /** See {@code Manifest#PACKAGE_VERIFICATION_AGENT} */
+    public static final String PACKAGE_VERIFICATION_AGENT =
+            "android.permission.PACKAGE_VERIFICATION_AGENT";
+    /** See {@code Manifest#BIND_PACKAGE_VERIFIER} */
+    public static final String BIND_PACKAGE_VERIFIER = "android.permission.BIND_PACKAGE_VERIFIER";
+    /** See {@code Manifest#PACKAGE_ROLLBACK_AGENT} */
+    public static final String PACKAGE_ROLLBACK_AGENT = "android.permission.PACKAGE_ROLLBACK_AGENT";
+    /** See {@code Manifest#MANAGE_ROLLBACKS} */
+    public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
+    /** See {@code Manifest#TEST_MANAGE_ROLLBACKS} */
+    public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS";
+    /** See {@code Manifest#SET_HARMFUL_APP_WARNINGS} */
+    public static final String SET_HARMFUL_APP_WARNINGS =
+            "android.permission.SET_HARMFUL_APP_WARNINGS";
+    /** See {@code Manifest#INTENT_FILTER_VERIFICATION_AGENT} */
+    public static final String INTENT_FILTER_VERIFICATION_AGENT =
+            "android.permission.INTENT_FILTER_VERIFICATION_AGENT";
+    /** See {@code Manifest#BIND_INTENT_FILTER_VERIFIER} */
+    public static final String BIND_INTENT_FILTER_VERIFIER = "android.permission"
+            + ".BIND_INTENT_FILTER_VERIFIER";
+    /** See {@code Manifest#DOMAIN_VERIFICATION_AGENT} */
+    public static final String DOMAIN_VERIFICATION_AGENT = "android.permission"
+            + ".DOMAIN_VERIFICATION_AGENT";
+    /** See {@code Manifest#BIND_DOMAIN_VERIFICATION_AGENT} */
+    public static final String BIND_DOMAIN_VERIFICATION_AGENT =
+            "android.permission.BIND_DOMAIN_VERIFICATION_AGENT";
+    /** See {@code Manifest#UPDATE_DOMAIN_VERIFICATION_USER_SELECTION} */
+    public static final String UPDATE_DOMAIN_VERIFICATION_USER_SELECTION =
+            "android.permission.UPDATE_DOMAIN_VERIFICATION_USER_SELECTION";
+    /** See {@code Manifest#SERIAL_PORT} */
+    public static final String SERIAL_PORT = "android.permission.SERIAL_PORT";
+    /** See {@code Manifest#ACCESS_CONTENT_PROVIDERS_EXTERNALLY} */
+    public static final String ACCESS_CONTENT_PROVIDERS_EXTERNALLY = "android.permission"
+            + ".ACCESS_CONTENT_PROVIDERS_EXTERNALLY";
+    /** See {@code Manifest#UPDATE_LOCK} */
+    public static final String UPDATE_LOCK = "android.permission.UPDATE_LOCK";
+    /** See {@code Manifest#REQUEST_NOTIFICATION_ASSISTANT_SERVICE} */
+    public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission"
+            + ".REQUEST_NOTIFICATION_ASSISTANT_SERVICE";
+    /** See {@code Manifest#ACCESS_NOTIFICATIONS} */
+    public static final String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
+    /** See {@code Manifest#ACCESS_NOTIFICATION_POLICY} */
+    public static final String ACCESS_NOTIFICATION_POLICY =
+            "android.permission.ACCESS_NOTIFICATION_POLICY";
+    /** See {@code Manifest#MANAGE_NOTIFICATIONS} */
+    public static final String MANAGE_NOTIFICATIONS = "android.permission.MANAGE_NOTIFICATIONS";
+    /** See {@code Manifest#MANAGE_NOTIFICATION_LISTENERS} */
+    public static final String MANAGE_NOTIFICATION_LISTENERS =
+            "android.permission.MANAGE_NOTIFICATION_LISTENERS";
+    /** See {@code Manifest#USE_COLORIZED_NOTIFICATIONS} */
+    public static final String USE_COLORIZED_NOTIFICATIONS =
+            "android.permission.USE_COLORIZED_NOTIFICATIONS";
+    /** See {@code Manifest#ACCESS_KEYGUARD_SECURE_STORAGE} */
+    public static final String ACCESS_KEYGUARD_SECURE_STORAGE = "android.permission"
+            + ".ACCESS_KEYGUARD_SECURE_STORAGE";
+    /** See {@code Manifest#SET_INITIAL_LOCK} */
+    public static final String SET_INITIAL_LOCK = "android.permission.SET_INITIAL_LOCK";
+    /** See {@code Manifest#SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS} */
+    public static final String SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS =
+            "android.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS";
+    /** See {@code Manifest#MANAGE_FINGERPRINT} */
+    public static final String MANAGE_FINGERPRINT = "android.permission.MANAGE_FINGERPRINT";
+    /** See {@code Manifest#RESET_FINGERPRINT_LOCKOUT} */
+    public static final String RESET_FINGERPRINT_LOCKOUT = "android.permission"
+            + ".RESET_FINGERPRINT_LOCKOUT";
+    /** See {@code Manifest#TEST_BIOMETRIC} */
+    public static final String TEST_BIOMETRIC = "android.permission.TEST_BIOMETRIC";
+    /** See {@code Manifest#MANAGE_BIOMETRIC} */
+    public static final String MANAGE_BIOMETRIC = "android.permission.MANAGE_BIOMETRIC";
+    /** See {@code Manifest#USE_BIOMETRIC_INTERNAL} */
+    public static final String USE_BIOMETRIC_INTERNAL = "android.permission"
+            + ".USE_BIOMETRIC_INTERNAL";
+    /** See {@code Manifest#MANAGE_BIOMETRIC_DIALOG} */
+    public static final String MANAGE_BIOMETRIC_DIALOG =
+            "android.permission.MANAGE_BIOMETRIC_DIALOG";
+    /** See {@code Manifest#CONTROL_KEYGUARD} */
+    public static final String CONTROL_KEYGUARD = "android.permission.CONTROL_KEYGUARD";
+    /** See {@code Manifest#CONTROL_KEYGUARD_SECURE_NOTIFICATIONS} */
+    public static final String CONTROL_KEYGUARD_SECURE_NOTIFICATIONS = "android.permission"
+            + ".CONTROL_KEYGUARD_SECURE_NOTIFICATIONS";
+    /** See {@code Manifest#TRUST_LISTENER} */
+    public static final String TRUST_LISTENER = "android.permission.TRUST_LISTENER";
+    /** See {@code Manifest#PROVIDE_TRUST_AGENT} */
+    public static final String PROVIDE_TRUST_AGENT = "android.permission.PROVIDE_TRUST_AGENT";
+    /** See {@code Manifest#SHOW_KEYGUARD_MESSAGE} */
+    public static final String SHOW_KEYGUARD_MESSAGE = "android.permission.SHOW_KEYGUARD_MESSAGE";
+    /** See {@code Manifest#LAUNCH_TRUST_AGENT_SETTINGS} */
+    public static final String LAUNCH_TRUST_AGENT_SETTINGS = "android.permission"
+            + ".LAUNCH_TRUST_AGENT_SETTINGS";
+    /** See {@code Manifest#BIND_TRUST_AGENT} */
+    public static final String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
+    /** See {@code Manifest#BIND_NOTIFICATION_LISTENER_SERVICE} */
+    public static final String BIND_NOTIFICATION_LISTENER_SERVICE =
+            "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
+    /** See {@code Manifest#BIND_NOTIFICATION_ASSISTANT_SERVICE} */
+    public static final String BIND_NOTIFICATION_ASSISTANT_SERVICE =
+            "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
+    /** See {@code Manifest#BIND_CHOOSER_TARGET_SERVICE} */
+    public static final String BIND_CHOOSER_TARGET_SERVICE =
+            "android.permission.BIND_CHOOSER_TARGET_SERVICE";
+    /** See {@code Manifest#PROVIDE_RESOLVER_RANKER_SERVICE} */
+    public static final String PROVIDE_RESOLVER_RANKER_SERVICE = "android.permission"
+            + ".PROVIDE_RESOLVER_RANKER_SERVICE";
+    /** See {@code Manifest#BIND_RESOLVER_RANKER_SERVICE} */
+    public static final String BIND_RESOLVER_RANKER_SERVICE =
+            "android.permission.BIND_RESOLVER_RANKER_SERVICE";
+    /** See {@code Manifest#BIND_CONDITION_PROVIDER_SERVICE} */
+    public static final String BIND_CONDITION_PROVIDER_SERVICE =
+            "android.permission.BIND_CONDITION_PROVIDER_SERVICE";
+    /** See {@code Manifest#BIND_DREAM_SERVICE} */
+    public static final String BIND_DREAM_SERVICE = "android.permission.BIND_DREAM_SERVICE";
+    /** See {@code Manifest#BIND_CACHE_QUOTA_SERVICE} */
+    public static final String BIND_CACHE_QUOTA_SERVICE = "android.permission"
+            + ".BIND_CACHE_QUOTA_SERVICE";
+    /** See {@code Manifest#INVOKE_CARRIER_SETUP} */
+    public static final String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP";
+    /** See {@code Manifest#ACCESS_NETWORK_CONDITIONS} */
+    public static final String ACCESS_NETWORK_CONDITIONS =
+            "android.permission.ACCESS_NETWORK_CONDITIONS";
+    /** See {@code Manifest#ACCESS_DRM_CERTIFICATES} */
+    public static final String ACCESS_DRM_CERTIFICATES =
+            "android.permission.ACCESS_DRM_CERTIFICATES";
+    /** See {@code Manifest#MANAGE_MEDIA_PROJECTION} */
+    public static final String MANAGE_MEDIA_PROJECTION =
+            "android.permission.MANAGE_MEDIA_PROJECTION";
+    /** See {@code Manifest#READ_INSTALL_SESSIONS} */
+    public static final String READ_INSTALL_SESSIONS = "android.permission.READ_INSTALL_SESSIONS";
+    /** See {@code Manifest#REMOVE_DRM_CERTIFICATES} */
+    public static final String REMOVE_DRM_CERTIFICATES = "android.permission"
+            + ".REMOVE_DRM_CERTIFICATES";
+    /** See {@code Manifest#BIND_CARRIER_MESSAGING_SERVICE} */
+    public static final String BIND_CARRIER_MESSAGING_SERVICE =
+            "android.permission.BIND_CARRIER_MESSAGING_SERVICE";
+    /** See {@code Manifest#ACCESS_VOICE_INTERACTION_SERVICE} */
+    public static final String ACCESS_VOICE_INTERACTION_SERVICE =
+            "android.permission.ACCESS_VOICE_INTERACTION_SERVICE";
+    /** See {@code Manifest#BIND_CARRIER_SERVICES} */
+    public static final String BIND_CARRIER_SERVICES = "android.permission.BIND_CARRIER_SERVICES";
+    /** See {@code Manifest#START_VIEW_PERMISSION_USAGE} */
+    public static final String START_VIEW_PERMISSION_USAGE = "android.permission"
+            + ".START_VIEW_PERMISSION_USAGE";
+    /** See {@code Manifest#QUERY_DO_NOT_ASK_CREDENTIALS_ON_BOOT} */
+    public static final String QUERY_DO_NOT_ASK_CREDENTIALS_ON_BOOT = "android.permission"
+            + ".QUERY_DO_NOT_ASK_CREDENTIALS_ON_BOOT";
+    /** See {@code Manifest#KILL_UID} */
+    public static final String KILL_UID = "android.permission.KILL_UID";
+    /** See {@code Manifest#LOCAL_MAC_ADDRESS} */
+    public static final String LOCAL_MAC_ADDRESS = "android.permission.LOCAL_MAC_ADDRESS";
+    /** See {@code Manifest#PEERS_MAC_ADDRESS} */
+    public static final String PEERS_MAC_ADDRESS = "android.permission.PEERS_MAC_ADDRESS";
+    /** See {@code Manifest#DISPATCH_NFC_MESSAGE} */
+    public static final String DISPATCH_NFC_MESSAGE = "android.permission.DISPATCH_NFC_MESSAGE";
+    /** See {@code Manifest#MODIFY_DAY_NIGHT_MODE} */
+    public static final String MODIFY_DAY_NIGHT_MODE = "android.permission.MODIFY_DAY_NIGHT_MODE";
+    /** See {@code Manifest#ENTER_CAR_MODE_PRIORITIZED} */
+    public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission"
+            + ".ENTER_CAR_MODE_PRIORITIZED";
+    /** See {@code Manifest#HANDLE_CAR_MODE_CHANGES} */
+    public static final String HANDLE_CAR_MODE_CHANGES = "android.permission"
+            + ".HANDLE_CAR_MODE_CHANGES";
+    /** See {@code Manifest#SEND_CATEGORY_CAR_NOTIFICATIONS} */
+    public static final String SEND_CATEGORY_CAR_NOTIFICATIONS =
+            "android.permission.SEND_CATEGORY_CAR_NOTIFICATIONS";
+    /** See {@code Manifest#ACCESS_INSTANT_APPS} */
+    public static final String ACCESS_INSTANT_APPS = "android.permission.ACCESS_INSTANT_APPS";
+    /** See {@code Manifest#VIEW_INSTANT_APPS} */
+    public static final String VIEW_INSTANT_APPS = "android.permission.VIEW_INSTANT_APPS";
+    /** See {@code Manifest#WRITE_COMMUNAL_STATE} */
+    public static final String WRITE_COMMUNAL_STATE = "android.permission.WRITE_COMMUNAL_STATE";
+    /** See {@code Manifest#READ_COMMUNAL_STATE} */
+    public static final String READ_COMMUNAL_STATE = "android.permission.READ_COMMUNAL_STATE";
+    /** See {@code Manifest#MANAGE_BIND_INSTANT_SERVICE} */
+    public static final String MANAGE_BIND_INSTANT_SERVICE =
+            "android.permission.MANAGE_BIND_INSTANT_SERVICE";
+    /** See {@code Manifest#RECEIVE_MEDIA_RESOURCE_USAGE} */
+    public static final String RECEIVE_MEDIA_RESOURCE_USAGE = "android.permission.RECEIVE_MEDIA_RESOURCE_USAGE";
+    /** See {@code Manifest#MANAGE_SOUND_TRIGGER} */
+    public static final String MANAGE_SOUND_TRIGGER = "android.permission.MANAGE_SOUND_TRIGGER";
+    /** See {@code Manifest#SOUND_TRIGGER_RUN_IN_BATTERY_SAVER} */
+    public static final String SOUND_TRIGGER_RUN_IN_BATTERY_SAVER = "android.permission"
+            + ".SOUND_TRIGGER_RUN_IN_BATTERY_SAVER";
+    /** See {@code Manifest#BIND_SOUND_TRIGGER_DETECTION_SERVICE} */
+    public static final String BIND_SOUND_TRIGGER_DETECTION_SERVICE = "android.permission"
+            + ".BIND_SOUND_TRIGGER_DETECTION_SERVICE";
+    /** See {@code Manifest#DISPATCH_PROVISIONING_MESSAGE} */
+    public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission"
+            + ".DISPATCH_PROVISIONING_MESSAGE";
+    /** See {@code Manifest#READ_BLOCKED_NUMBERS} */
+    public static final String READ_BLOCKED_NUMBERS = "android.permission.READ_BLOCKED_NUMBERS";
+    /** See {@code Manifest#WRITE_BLOCKED_NUMBERS} */
+    public static final String WRITE_BLOCKED_NUMBERS = "android.permission.WRITE_BLOCKED_NUMBERS";
+    /** See {@code Manifest#BIND_VR_LISTENER_SERVICE} */
+    public static final String BIND_VR_LISTENER_SERVICE = "android.permission"
+            + ".BIND_VR_LISTENER_SERVICE";
+    /** See {@code Manifest#RESTRICTED_VR_ACCESS} */
+    public static final String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
+    /** See {@code Manifest#ACCESS_VR_MANAGER} */
+    public static final String ACCESS_VR_MANAGER = "android.permission.ACCESS_VR_MANAGER";
+    /** See {@code Manifest#ACCESS_VR_STATE} */
+    public static final String ACCESS_VR_STATE = "android.permission.ACCESS_VR_STATE";
+    /** See {@code Manifest#UPDATE_LOCK_TASK_PACKAGES} */
+    public static final String UPDATE_LOCK_TASK_PACKAGES =
+            "android.permission.UPDATE_LOCK_TASK_PACKAGES";
+    /** See {@code Manifest#SUBSTITUTE_NOTIFICATION_APP_NAME} */
+    public static final String SUBSTITUTE_NOTIFICATION_APP_NAME = "android.permission"
+            + ".SUBSTITUTE_NOTIFICATION_APP_NAME";
+    /** See {@code Manifest#NOTIFICATION_DURING_SETUP} */
+    public static final String NOTIFICATION_DURING_SETUP =
+            "android.permission.NOTIFICATION_DURING_SETUP";
+    /** See {@code Manifest#MANAGE_AUTO_FILL} */
+    public static final String MANAGE_AUTO_FILL = "android.permission.MANAGE_AUTO_FILL";
+    /** See {@code Manifest#MANAGE_CONTENT_CAPTURE} */
+    public static final String MANAGE_CONTENT_CAPTURE = "android.permission.MANAGE_CONTENT_CAPTURE";
+    /** See {@code Manifest#MANAGE_ROTATION_RESOLVER} */
+    public static final String MANAGE_ROTATION_RESOLVER = "android.permission"
+            + ".MANAGE_ROTATION_RESOLVER";
+    /** See {@code Manifest#MANAGE_MUSIC_RECOGNITION} */
+    public static final String MANAGE_MUSIC_RECOGNITION =
+            "android.permission.MANAGE_MUSIC_RECOGNITION";
+    /** See {@code Manifest#MANAGE_SPEECH_RECOGNITION} */
+    public static final String MANAGE_SPEECH_RECOGNITION =
+            "android.permission.MANAGE_SPEECH_RECOGNITION";
+    /** See {@code Manifest#MANAGE_CONTENT_SUGGESTIONS} */
+    public static final String MANAGE_CONTENT_SUGGESTIONS = "android.permission"
+            + ".MANAGE_CONTENT_SUGGESTIONS";
+    /** See {@code Manifest#MANAGE_APP_PREDICTIONS} */
+    public static final String MANAGE_APP_PREDICTIONS = "android.permission.MANAGE_APP_PREDICTIONS";
+    /** See {@code Manifest#MANAGE_SEARCH_UI} */
+    public static final String MANAGE_SEARCH_UI = "android.permission.MANAGE_SEARCH_UI";
+    /** See {@code Manifest#MANAGE_SMARTSPACE} */
+    public static final String MANAGE_SMARTSPACE = "android.permission.MANAGE_SMARTSPACE";
+    /** See {@code Manifest#MODIFY_THEME_OVERLAY} */
+    public static final String MODIFY_THEME_OVERLAY = "android.permission.MODIFY_THEME_OVERLAY";
+    /** See {@code Manifest#INSTANT_APP_FOREGROUND_SERVICE} */
+    public static final String INSTANT_APP_FOREGROUND_SERVICE =
+            "android.permission.INSTANT_APP_FOREGROUND_SERVICE";
+    /** See {@code Manifest#FOREGROUND_SERVICE} */
+    public static final String FOREGROUND_SERVICE = "android.permission.FOREGROUND_SERVICE";
+    /** See {@code Manifest#ACCESS_SHORTCUTS} */
+    public static final String ACCESS_SHORTCUTS = "android.permission.ACCESS_SHORTCUTS";
+    /** See {@code Manifest#UNLIMITED_SHORTCUTS_API_CALLS} */
+    public static final String UNLIMITED_SHORTCUTS_API_CALLS =
+            "android.permission.UNLIMITED_SHORTCUTS_API_CALLS";
+    /** See {@code Manifest#READ_RUNTIME_PROFILES} */
+    public static final String READ_RUNTIME_PROFILES = "android.permission.READ_RUNTIME_PROFILES";
+    /** See {@code Manifest#MANAGE_AUDIO_POLICY} */
+    public static final String MANAGE_AUDIO_POLICY = "android.permission.MANAGE_AUDIO_POLICY";
+    /** See {@code Manifest#MODIFY_QUIET_MODE} */
+    public static final String MODIFY_QUIET_MODE = "android.permission.MODIFY_QUIET_MODE";
+    /** See {@code Manifest#MANAGE_CAMERA} */
+    public static final String MANAGE_CAMERA = "android.permission.MANAGE_CAMERA";
+    /** See {@code Manifest#CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS} */
+    public static final String CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS =
+            "android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
+    /** See {@code Manifest#WATCH_APPOPS} */
+    public static final String WATCH_APPOPS = "android.permission.WATCH_APPOPS";
+    /** See {@code Manifest#DISABLE_HIDDEN_API_CHECKS} */
+    public static final String DISABLE_HIDDEN_API_CHECKS =
+            "android.permission.DISABLE_HIDDEN_API_CHECKS";
+    /** See {@code Manifest#MONITOR_DEFAULT_SMS_PACKAGE} */
+    public static final String MONITOR_DEFAULT_SMS_PACKAGE =
+            "android.permission.MONITOR_DEFAULT_SMS_PACKAGE";
+    /** See {@code Manifest#BIND_CARRIER_MESSAGING_CLIENT_SERVICE} */
+    public static final String BIND_CARRIER_MESSAGING_CLIENT_SERVICE =
+            "android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE";
+    /** See {@code Manifest#BIND_EXPLICIT_HEALTH_CHECK_SERVICE} */
+    public static final String BIND_EXPLICIT_HEALTH_CHECK_SERVICE =
+            "android.permission.BIND_EXPLICIT_HEALTH_CHECK_SERVICE";
+    /** See {@code Manifest#BIND_EXTERNAL_STORAGE_SERVICE} */
+    public static final String BIND_EXTERNAL_STORAGE_SERVICE = "android.permission"
+            + ".BIND_EXTERNAL_STORAGE_SERVICE";
+    /** See {@code Manifest#MANAGE_APPOPS} */
+    public static final String MANAGE_APPOPS = "android.permission.MANAGE_APPOPS";
+    /** See {@code Manifest#READ_CLIPBOARD_IN_BACKGROUND} */
+    public static final String READ_CLIPBOARD_IN_BACKGROUND = "android.permission"
+            + ".READ_CLIPBOARD_IN_BACKGROUND";
+    /** See {@code Manifest#MANAGE_ACCESSIBILITY} */
+    public static final String MANAGE_ACCESSIBILITY = "android.permission.MANAGE_ACCESSIBILITY";
+    /** See {@code Manifest#GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS} */
+    public static final String GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS =
+            "android.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS";
+    /** See {@code Manifest#MARK_DEVICE_ORGANIZATION_OWNED} */
+    public static final String MARK_DEVICE_ORGANIZATION_OWNED = "android.permission"
+            + ".MARK_DEVICE_ORGANIZATION_OWNED";
+    /** See {@code Manifest#SMS_FINANCIAL_TRANSACTIONS} */
+    public static final String SMS_FINANCIAL_TRANSACTIONS =
+            "android.permission.SMS_FINANCIAL_TRANSACTIONS";
+    /** See {@code Manifest#USE_FULL_SCREEN_INTENT} */
+    public static final String USE_FULL_SCREEN_INTENT = "android.permission.USE_FULL_SCREEN_INTENT";
+    /** See {@code Manifest#SEND_DEVICE_CUSTOMIZATION_READY} */
+    public static final String SEND_DEVICE_CUSTOMIZATION_READY =
+            "android.permission.SEND_DEVICE_CUSTOMIZATION_READY";
+    /** See {@code Manifest#RECEIVE_DEVICE_CUSTOMIZATION_READY} */
+    public static final String RECEIVE_DEVICE_CUSTOMIZATION_READY =
+            "android.permission.RECEIVE_DEVICE_CUSTOMIZATION_READY";
+    /** See {@code Manifest#AMBIENT_WALLPAPER} */
+    public static final String AMBIENT_WALLPAPER = "android.permission.AMBIENT_WALLPAPER";
+    /** See {@code Manifest#MANAGE_SENSOR_PRIVACY} */
+    public static final String MANAGE_SENSOR_PRIVACY = "android.permission.MANAGE_SENSOR_PRIVACY";
+    /** See {@code Manifest#OBSERVE_SENSOR_PRIVACY} */
+    public static final String OBSERVE_SENSOR_PRIVACY = "android.permission.OBSERVE_SENSOR_PRIVACY";
+    /** See {@code Manifest#REVIEW_ACCESSIBILITY_SERVICES} */
+    public static final String REVIEW_ACCESSIBILITY_SERVICES =
+            "android.permission.REVIEW_ACCESSIBILITY_SERVICES";
+    /** See {@code Manifest#SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON} */
+    public static final String SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON =
+            "android.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON";
+    /** See {@code Manifest#ACCESS_SHARED_LIBRARIES} */
+    public static final String ACCESS_SHARED_LIBRARIES =
+            "android.permission.ACCESS_SHARED_LIBRARIES";
+    /** See {@code Manifest#LOG_COMPAT_CHANGE} */
+    public static final String LOG_COMPAT_CHANGE = "android.permission.LOG_COMPAT_CHANGE";
+    /** See {@code Manifest#READ_COMPAT_CHANGE_CONFIG} */
+    public static final String READ_COMPAT_CHANGE_CONFIG =
+            "android.permission.READ_COMPAT_CHANGE_CONFIG";
+    /** See {@code Manifest#OVERRIDE_COMPAT_CHANGE_CONFIG} */
+    public static final String OVERRIDE_COMPAT_CHANGE_CONFIG =
+            "android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG";
+    /** See {@code Manifest#OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD} */
+    public static final String OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD =
+            "android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD";
+    /** See {@code Manifest#MONITOR_INPUT} */
+    public static final String MONITOR_INPUT = "android.permission.MONITOR_INPUT";
+    /** See {@code Manifest#ASSOCIATE_INPUT_DEVICE_TO_DISPLAY} */
+    public static final String ASSOCIATE_INPUT_DEVICE_TO_DISPLAY =
+            "android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY";
+    /** See {@code Manifest#QUERY_ALL_PACKAGES} */
+    public static final String QUERY_ALL_PACKAGES = "android.permission.QUERY_ALL_PACKAGES";
+    /** See {@code Manifest#PEEK_DROPBOX_DATA} */
+    public static final String PEEK_DROPBOX_DATA = "android.permission.PEEK_DROPBOX_DATA";
+    /** See {@code Manifest#ACCESS_TV_TUNER} */
+    public static final String ACCESS_TV_TUNER = "android.permission.ACCESS_TV_TUNER";
+    /** See {@code Manifest#ACCESS_TV_DESCRAMBLER} */
+    public static final String ACCESS_TV_DESCRAMBLER = "android.permission.ACCESS_TV_DESCRAMBLER";
+    /** See {@code Manifest#ACCESS_TV_SHARED_FILTER} */
+    public static final String ACCESS_TV_SHARED_FILTER =
+            "android.permission.ACCESS_TV_SHARED_FILTER";
+    /** See {@code Manifest#ADD_TRUSTED_DISPLAY} */
+    public static final String ADD_TRUSTED_DISPLAY = "android.permission.ADD_TRUSTED_DISPLAY";
+    /** See {@code Manifest#ADD_ALWAYS_UNLOCKED_DISPLAY} */
+    public static final String ADD_ALWAYS_UNLOCKED_DISPLAY =
+            "android.permission.ADD_ALWAYS_UNLOCKED_DISPLAY";
+    /** See {@code Manifest#ACCESS_LOCUS_ID_USAGE_STATS} */
+    public static final String ACCESS_LOCUS_ID_USAGE_STATS =
+            "android.permission.ACCESS_LOCUS_ID_USAGE_STATS";
+    /** See {@code Manifest#MANAGE_APP_HIBERNATION} */
+    public static final String MANAGE_APP_HIBERNATION = "android.permission.MANAGE_APP_HIBERNATION";
+    /** See {@code Manifest#RESET_APP_ERRORS} */
+    public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS";
+    /** See {@code Manifest#INPUT_CONSUMER} */
+    public static final String INPUT_CONSUMER = "android.permission.INPUT_CONSUMER";
+    /** See {@code Manifest#CONTROL_DEVICE_STATE} */
+    public static final String CONTROL_DEVICE_STATE = "android.permission.CONTROL_DEVICE_STATE";
+    /** See {@code Manifest#BIND_DISPLAY_HASHING_SERVICE} */
+    public static final String BIND_DISPLAY_HASHING_SERVICE =
+            "android.permission.BIND_DISPLAY_HASHING_SERVICE";
+    /** See {@code Manifest#MANAGE_TOAST_RATE_LIMITING} */
+    public static final String MANAGE_TOAST_RATE_LIMITING =
+            "android.permission.MANAGE_TOAST_RATE_LIMITING";
+    /** See {@code Manifest#MANAGE_GAME_MODE} */
+    public static final String MANAGE_GAME_MODE = "android.permission.MANAGE_GAME_MODE";
+    /** See {@code Manifest#SIGNAL_REBOOT_READINESS} */
+    public static final String SIGNAL_REBOOT_READINESS =
+            "android.permission.SIGNAL_REBOOT_READINESS";
+    /** See {@code Manifest#GET_PEOPLE_TILE_PREVIEW} */
+    public static final String GET_PEOPLE_TILE_PREVIEW =
+            "android.permission.GET_PEOPLE_TILE_PREVIEW";
+    /** See {@code Manifest#READ_PEOPLE_DATA} */
+    public static final String READ_PEOPLE_DATA = "android.permission.READ_PEOPLE_DATA";
+    /** See {@code Manifest#RENOUNCE_PERMISSIONS} */
+    public static final String RENOUNCE_PERMISSIONS = "android.permission.RENOUNCE_PERMISSIONS";
+    /** See {@code Manifest#READ_NEARBY_STREAMING_POLICY} */
+    public static final String READ_NEARBY_STREAMING_POLICY =
+            "android.permission.READ_NEARBY_STREAMING_POLICY";
+    /** See {@code Manifest#SET_CLIP_SOURCE} */
+    public static final String SET_CLIP_SOURCE = "android.permission.SET_CLIP_SOURCE";
+    /** See {@code Manifest#ACCESS_TUNED_INFO} */
+    public static final String ACCESS_TUNED_INFO = "android.permission.ACCESS_TUNED_INFO";
+    /** See {@code Manifest#UPDATE_PACKAGES_WITHOUT_USER_ACTION} */
+    public static final String UPDATE_PACKAGES_WITHOUT_USER_ACTION =
+            "android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION";
+    /** See {@code Manifest#CAPTURE_BLACKOUT_CONTENT} */
+    public static final String CAPTURE_BLACKOUT_CONTENT =
+            "android.permission.CAPTURE_BLACKOUT_CONTENT";
+    /** See {@code Manifest#READ_GLOBAL_APP_SEARCH_DATA} */
+    public static final String READ_GLOBAL_APP_SEARCH_DATA =
+            "android.permission.READ_GLOBAL_APP_SEARCH_DATA";
+    /** See {@code Manifest#CREATE_VIRTUAL_DEVICE} */
+    public static final String CREATE_VIRTUAL_DEVICE = "android.permission.CREATE_VIRTUAL_DEVICE";
+    /** See {@code Manifest#SEND_SAFETY_CENTER_UPDATE} */
+    public static final String SEND_SAFETY_CENTER_UPDATE =
+            "android.permission.SEND_SAFETY_CENTER_UPDATE";
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Tags.java b/common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/utils/Tags.java
similarity index 100%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Tags.java
rename to common/device-side/bedstead/nene/common/src/main/java/com/android/bedstead/nene/utils/Tags.java
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/appops/AppOps.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/appops/AppOps.java
index ee9927f..d7ca18a 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/appops/AppOps.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/appops/AppOps.java
@@ -18,7 +18,7 @@
 
 import static android.os.Build.VERSION_CODES.Q;
 
-import static com.android.bedstead.nene.permissions.Permissions.MANAGE_APP_OPS_MODES;
+import static com.android.bedstead.nene.permissions.CommonPermissions.MANAGE_APP_OPS_MODES;
 
 import android.annotation.TargetApi;
 import android.app.AppOpsManager;
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserReference.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserReference.java
index 90fa150..4ca2fce 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserReference.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserReference.java
@@ -22,7 +22,7 @@
 import static android.os.Build.VERSION_CODES.R;
 import static android.os.Build.VERSION_CODES.S;
 
-import static com.android.bedstead.nene.permissions.Permissions.MANAGE_PROFILE_AND_DEVICE_OWNERS;
+import static com.android.bedstead.nene.permissions.CommonPermissions.MANAGE_PROFILE_AND_DEVICE_OWNERS;
 import static com.android.bedstead.nene.users.Users.users;
 
 import android.app.KeyguardManager;
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UsersTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UsersTest.java
index 1769a01..d166477 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UsersTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UsersTest.java
@@ -21,8 +21,8 @@
 import static android.app.ActivityManager.STOP_USER_ON_SWITCH_TRUE;
 import static android.os.Build.VERSION.SDK_INT;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.SYSTEM_USER;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+import static com.android.bedstead.harrier.UserType.SYSTEM_USER;
 import static com.android.bedstead.nene.users.UserType.MANAGED_PROFILE_TYPE_NAME;
 import static com.android.bedstead.nene.users.UserType.SECONDARY_USER_TYPE_NAME;
 import static com.android.bedstead.nene.users.UserType.SYSTEM_USER_TYPE_NAME;
diff --git a/hostsidetests/appcompat/compatchanges/app/src/com/android/cts/appcompat/compatchanges/CompatChangesTest.java b/hostsidetests/appcompat/compatchanges/app/src/com/android/cts/appcompat/compatchanges/CompatChangesTest.java
index 3212c99..cd852ea 100644
--- a/hostsidetests/appcompat/compatchanges/app/src/com/android/cts/appcompat/compatchanges/CompatChangesTest.java
+++ b/hostsidetests/appcompat/compatchanges/app/src/com/android/cts/appcompat/compatchanges/CompatChangesTest.java
@@ -17,6 +17,7 @@
 package com.android.cts.appcompat.compatchanges;
 
 import static com.google.common.truth.Truth.assertThat;
+
 import static org.junit.Assert.assertThrows;
 
 import android.Manifest;
@@ -34,6 +35,9 @@
 import org.junit.runner.RunWith;
 
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Tests for the {@link android.app.compat.CompatChanges} SystemApi.
@@ -46,160 +50,199 @@
  */
 @RunWith(AndroidJUnit4.class)
 public final class CompatChangesTest {
-  private static final long CTS_SYSTEM_API_CHANGEID = 149391281L;
-  private static final long CTS_SYSTEM_API_OVERRIDABLE_CHANGEID = 174043039L;
-  private static final long UNKNOWN_CHANGEID = 123L;
+    private static final long CTS_SYSTEM_API_CHANGEID = 149391281L;
+    private static final long CTS_SYSTEM_API_OVERRIDABLE_CHANGEID = 174043039L;
+    private static final long UNKNOWN_CHANGEID = 123L;
 
-  private static final String OVERRIDE_PACKAGE = "com.android.cts.appcompat.preinstalloverride";
+    private static final String OVERRIDE_PACKAGE = "com.android.cts.appcompat.preinstalloverride";
+    private static final String OVERRIDE_PACKAGE2 = "com.android.cts.appcompat.preinstalloverride2";
 
-  @Before
-  public void setUp() {
-    InstrumentationRegistry.getInstrumentation().getUiAutomation()
-      .adoptShellPermissionIdentity(Manifest.permission.LOG_COMPAT_CHANGE,
-                                    Manifest.permission.READ_COMPAT_CHANGE_CONFIG,
-                                    Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD,
-                                    Manifest.permission.INTERACT_ACROSS_USERS_FULL);
-  }
+    @Before
+    public void setUp() {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity(Manifest.permission.LOG_COMPAT_CHANGE,
+                        Manifest.permission.READ_COMPAT_CHANGE_CONFIG,
+                        Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD,
+                        Manifest.permission.INTERACT_ACROSS_USERS_FULL);
+    }
 
-  @After
-  public void tearDown() {
-    InstrumentationRegistry.getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
-  }
+    @After
+    public void tearDown() {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .dropShellPermissionIdentity();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeEnabled */
-  @Test
-  public void isChangeEnabled_changeEnabled() {
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID)).isTrue();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeEnabled */
+    @Test
+    public void isChangeEnabled_changeEnabled() {
+        assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID)).isTrue();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeEnabledPackageName */
-  @Test
-  public void isChangeEnabledPackageName_changeEnabled() {
-    Context context = InstrumentationRegistry.getTargetContext();
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, context.getPackageName(),
-            context.getUser())).isTrue();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeEnabledPackageName */
+    @Test
+    public void isChangeEnabledPackageName_changeEnabled() {
+        Context context = InstrumentationRegistry.getTargetContext();
+        assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, context.getPackageName(),
+                context.getUser())).isTrue();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeEnabledUid */
-  @Test
-  public void isChangeEnabledUid_changeEnabled() {
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, Process.myUid())).isTrue();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeEnabledUid */
+    @Test
+    public void isChangeEnabledUid_changeEnabled() {
+        assertThat(
+                CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, Process.myUid())).isTrue();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeDisabled */
-  @Test
-  public void isChangeEnabled_changeDisabled() {
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID)).isFalse();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeDisabled */
+    @Test
+    public void isChangeEnabled_changeDisabled() {
+        assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID)).isFalse();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeDisabledPackageName */
-  @Test
-  public void isChangeEnabledPackageName_changeDisabled() {
-    Context context = InstrumentationRegistry.getTargetContext();
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, context.getPackageName(),
-            context.getUser())).isFalse();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeDisabledPackageName */
+    @Test
+    public void isChangeEnabledPackageName_changeDisabled() {
+        Context context = InstrumentationRegistry.getTargetContext();
+        assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, context.getPackageName(),
+                context.getUser())).isFalse();
+    }
 
-  /* Test run by CompatChangesSystemApiTest.testIsChangeDisabledUid */
-  @Test
-  public void isChangeEnabledUid_changeDisabled() {
-    assertThat(CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, Process.myUid())).isFalse();
-  }
+    /* Test run by CompatChangesSystemApiTest.testIsChangeDisabledUid */
+    @Test
+    public void isChangeEnabledUid_changeDisabled() {
+        assertThat(
+                CompatChanges.isChangeEnabled(CTS_SYSTEM_API_CHANGEID, Process.myUid())).isFalse();
+    }
 
-  @Test
-  public void putPackageOverrides_securityExceptionForNonOverridableChangeId() {
-    SecurityException e = assertThrows(SecurityException.class,
-            () -> CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-                    Collections.singletonMap(CTS_SYSTEM_API_CHANGEID,
-                    new PackageOverride.Builder().setEnabled(true).build())));
-    assertThat(e).hasMessageThat().contains("marked as Overridable");
-  }
+    @Test
+    public void putPackageOverrides_securityExceptionForNonOverridableChangeId() {
+        SecurityException e = assertThrows(SecurityException.class,
+                () -> CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                        Collections.singletonMap(CTS_SYSTEM_API_CHANGEID,
+                                new PackageOverride.Builder().setEnabled(true).build())));
+        assertThat(e).hasMessageThat().contains("marked as Overridable");
+    }
 
-  @Test
-  public void putPackageOverrides_doesNothingIfChangeIsUnknown() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(UNKNOWN_CHANGEID,
-                    new PackageOverride.Builder().setEnabled(true).build()));
-  }
+    @Test
+    public void putPackageOverrides_doesNothingIfChangeIsUnknown() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(UNKNOWN_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+    }
 
-  @Test
-  public void putPackageOverrides_success() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                    new PackageOverride.Builder().setEnabled(true).build()));
-  }
+    @Test
+    public void putPackageOverrides_success() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+    }
 
-  @Test
-  public void putPackageOverrides_fromVersion2() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                    new PackageOverride.Builder().setMinVersionCode(2).setEnabled(true).build()));
-  }
+    @Test
+    public void putPackageOverrides_fromVersion2() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setMinVersionCode(2).setEnabled(
+                                true).build()));
+    }
 
-  @Test
-  public void putPackageOverrides_untilVersion1() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                    new PackageOverride.Builder().setMaxVersionCode(1).setEnabled(true).build()));
-  }
+    @Test
+    public void putPackageOverrides_untilVersion1() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setMaxVersionCode(1).setEnabled(
+                                true).build()));
+    }
 
-  @Test
-  public void putPackageOverrides_securityExceptionForNotHoldingPermission() {
-    // Adopt the normal override permission that doesn't allow to clear overrides on release builds
-    InstrumentationRegistry.getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
-    InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
-            Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG);
+    @Test
+    public void putPackageOverrides_securityExceptionForNotHoldingPermission() {
+        // Adopt the normal override permission that doesn't allow to clear overrides on release
+        // builds
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .dropShellPermissionIdentity();
+        InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
+                Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG);
 
-    SecurityException e = assertThrows(SecurityException.class,
-            () -> CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-                    Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                            new PackageOverride.Builder().setEnabled(true).build())));
-    assertThat(e).hasMessageThat().contains("Cannot override compat change");
-  }
+        SecurityException e = assertThrows(SecurityException.class,
+                () -> CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                        Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                                new PackageOverride.Builder().setEnabled(true).build())));
+        assertThat(e).hasMessageThat().contains("Cannot override compat change");
+    }
 
-  @Test
-  public void removePackageOverrides_securityExceptionForNonOverridableChangeId() {
-    SecurityException e = assertThrows(SecurityException.class,
-            () -> CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
-                    Collections.singleton(CTS_SYSTEM_API_CHANGEID)));
-    assertThat(e).hasMessageThat().contains("marked as Overridable");
-  }
+    @Test
+    public void putAllPackageOverrides_success() {
+        Map<String, Map<Long, PackageOverride>> packageNameToOverrides = new HashMap<>();
+        packageNameToOverrides.put(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+        packageNameToOverrides.put(OVERRIDE_PACKAGE2,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+        CompatChanges.putAllPackageOverrides(packageNameToOverrides);
+    }
 
-  @Test
-  public void removePackageOverrides_doesNothingIfOverrideNotPresent() {
-    CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
-  }
+    @Test
+    public void removePackageOverrides_securityExceptionForNonOverridableChangeId() {
+        SecurityException e = assertThrows(SecurityException.class,
+                () -> CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+                        Collections.singleton(CTS_SYSTEM_API_CHANGEID)));
+        assertThat(e).hasMessageThat().contains("marked as Overridable");
+    }
 
-  @Test
-  public void removePackageOverrides_doesNothingIfChangeIsUnknown() {
-    CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singleton(UNKNOWN_CHANGEID));
-  }
+    @Test
+    public void removePackageOverrides_doesNothingIfOverrideNotPresent() {
+        CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
+    }
 
-  @Test
-  public void removePackageOverrides_overridePresentSuccess() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                    new PackageOverride.Builder().setEnabled(true).build()));
-    CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
-  }
+    @Test
+    public void removePackageOverrides_doesNothingIfChangeIsUnknown() {
+        CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singleton(UNKNOWN_CHANGEID));
+    }
 
-  @Test
-  public void removePackageOverrides_securityExceptionForNotHoldingPermission() {
-    CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
-            Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
-                    new PackageOverride.Builder().setEnabled(true).build()));
+    @Test
+    public void removePackageOverrides_overridePresentSuccess() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+        CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
+    }
 
-    // Adopt the normal override permission that doesn't allow to clear overrides on release builds
-    InstrumentationRegistry.getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
-    InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
-            Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG);
+    @Test
+    public void removePackageOverrides_securityExceptionForNotHoldingPermission() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
 
-    SecurityException e = assertThrows(SecurityException.class,
-            () -> CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
-                    Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID)));
-    assertThat(e).hasMessageThat().contains("Cannot override compat change");
-  }
+        // Adopt the normal override permission that doesn't allow to clear overrides on release
+        // builds
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .dropShellPermissionIdentity();
+        InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
+                Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG);
+
+        SecurityException e = assertThrows(SecurityException.class,
+                () -> CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+                        Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID)));
+        assertThat(e).hasMessageThat().contains("Cannot override compat change");
+    }
+
+    @Test
+    public void removeAllPackageOverrides_overridePresentSuccess() {
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+        CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE2,
+                Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
+                        new PackageOverride.Builder().setEnabled(true).build()));
+
+        Map<String, Set<Long>> packageNameToOverridesToRemove = new HashMap<>();
+        packageNameToOverridesToRemove.put(OVERRIDE_PACKAGE,
+                Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
+        packageNameToOverridesToRemove.put(OVERRIDE_PACKAGE2,
+                Collections.singleton(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID));
+        CompatChanges.removeAllPackageOverrides(packageNameToOverridesToRemove);
+    }
 }
diff --git a/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/Android.bp b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/Android.bp
index 0353cb7..9d2b53e 100644
--- a/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/Android.bp
+++ b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/Android.bp
@@ -79,3 +79,17 @@
         "general-tests",
     ],
 }
+
+android_test_helper_app {
+    name: "appcompat_preinstall_override2_versioncode1_release",
+    defaults: ["cts_defaults"],
+    sdk_version: "current",
+    static_libs: ["pre_install_override_lib"],
+    manifest: "AndroidManifest_2_versioncode1_release.xml",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts10",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/AndroidManifest_2_versioncode1_release.xml b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/AndroidManifest_2_versioncode1_release.xml
new file mode 100644
index 0000000..15a89c7
--- /dev/null
+++ b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/AndroidManifest_2_versioncode1_release.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2021 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.
+  -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.android.cts.appcompat.preinstalloverride2"
+          android:versionCode="1">
+    <uses-sdk android:targetSdkVersion="30"/>
+    <application android:debuggable="false">
+        <activity android:name=".Empty" android:exported="true" />
+    </application>
+</manifest>
diff --git a/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/src/com/android/cts/appcompat/preinstalloverride2/EmptyActivity.java b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/src/com/android/cts/appcompat/preinstalloverride2/EmptyActivity.java
new file mode 100644
index 0000000..fd8061f
--- /dev/null
+++ b/hostsidetests/appcompat/compatchanges/preInstallOverrideApps/src/com/android/cts/appcompat/preinstalloverride2/EmptyActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2021 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 com.android.cts.appcompat.preinstalloverride2;
+
+import android.app.Activity;
+
+public class EmptyActivity extends Activity {
+
+}
diff --git a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java
index 66fdf19..fbc7a58 100644
--- a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java
@@ -29,6 +29,7 @@
     private static final String TEST_PKG = "com.android.cts.appcompat.compatchanges";
 
     private static final String OVERRIDE_PKG = "com.android.cts.appcompat.preinstalloverride";
+    private static final String OVERRIDE_PKG2 = "com.android.cts.appcompat.preinstalloverride2";
 
     private static final long CTS_OVERRIDABLE_CHANGE_ID = 174043039L;
     private static final long UNKNOWN_CHANGEID = 123L;
@@ -37,14 +38,17 @@
     protected void setUp() throws Exception {
         installPackage(TEST_APK, true);
         runCommand("am compat reset-all " + OVERRIDE_PKG);
+        runCommand("am compat reset-all " + OVERRIDE_PKG2);
         runCommand("settings put global force_non_debuggable_final_build_for_compat 1");
     }
 
     @Override
     protected void tearDown() throws Exception {
         runCommand("am compat reset-all " + OVERRIDE_PKG);
+        runCommand("am compat reset-all " + OVERRIDE_PKG2);
         uninstallPackage(TEST_PKG, true);
         uninstallPackage(OVERRIDE_PKG, false);
+        uninstallPackage(OVERRIDE_PKG2, false);
         runCommand("settings put global force_non_debuggable_final_build_for_compat 0");
     }
 
@@ -176,6 +180,26 @@
         assertThat(ctsChange.hasOverrides).isFalse();
     }
 
+    public void testPutAllPackageOverrides() throws Exception {
+        installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
+        installPackage("appcompat_preinstall_override2_versioncode1_release.apk", false);
+
+        runDeviceCompatTest(TEST_PKG, ".CompatChangesTest",
+                "putAllPackageOverrides_success",
+                /*enabledChanges*/ImmutableSet.of(),
+                /*disabledChanges*/ ImmutableSet.of());
+
+        Change ctsChange = getOnDeviceChangeIdConfig(CTS_OVERRIDABLE_CHANGE_ID);
+        assertWithMessage("CTS specific change %s not found on device", CTS_OVERRIDABLE_CHANGE_ID)
+                .that(ctsChange).isNotNull();
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                "{" + OVERRIDE_PKG + "=true, " + OVERRIDE_PKG2 + "=true}");
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                "{" + OVERRIDE_PKG + "=true, " + OVERRIDE_PKG2 + "=true}");
+    }
+
     public void testRemovePackageOverridesSecurityExceptionNonOverridableChangeId()
             throws Exception {
         installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
@@ -243,4 +267,20 @@
         assertThat(ctsChange.hasRawOverrides).isFalse();
         assertThat(ctsChange.hasOverrides).isFalse();
     }
+
+    public void testRemoveAllPackageOverridesWhenOverridePresent() throws Exception {
+        installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
+        installPackage("appcompat_preinstall_override2_versioncode1_release.apk", false);
+
+        runDeviceCompatTest(TEST_PKG, ".CompatChangesTest",
+                "removeAllPackageOverrides_overridePresentSuccess",
+                /*enabledChanges*/ImmutableSet.of(),
+                /*disabledChanges*/ ImmutableSet.of());
+
+        Change ctsChange = getOnDeviceChangeIdConfig(CTS_OVERRIDABLE_CHANGE_ID);
+        assertWithMessage("CTS specific change %s not found on device", CTS_OVERRIDABLE_CHANGE_ID)
+                .that(ctsChange).isNotNull();
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+        assertThat(ctsChange.hasOverrides).isFalse();
+    }
 }
diff --git a/hostsidetests/appsearch/Android.bp b/hostsidetests/appsearch/Android.bp
index 57a33b8..36a27d7 100644
--- a/hostsidetests/appsearch/Android.bp
+++ b/hostsidetests/appsearch/Android.bp
@@ -29,11 +29,12 @@
         "tools-common-prebuilt",
         "cts-tradefed",
         "tradefed",
-        "truth-prebuilt"
+        "truth-prebuilt",
     ],
     test_suites: [
         "cts",
         "general-tests",
+        "mts-appsearch",
     ],
 }
 
@@ -53,6 +54,7 @@
     test_suites: [
         "cts",
         "general-tests",
+        "mts-appsearch",
     ],
     manifest: "test-apps/AppSearchHostTestHelperA/AndroidManifest.xml",
     certificate: ":cts-appsearch-hosttest-helper-cert-a",
@@ -75,6 +77,7 @@
     test_suites: [
         "cts",
         "general-tests",
+        "mts-appsearch",
     ],
     manifest: "test-apps/AppSearchHostTestHelperB/AndroidManifest.xml",
     certificate: ":cts-appsearch-hosttest-helper-cert-b",
diff --git a/hostsidetests/appsearch/AndroidTest.xml b/hostsidetests/appsearch/AndroidTest.xml
index 229e352..a538916 100644
--- a/hostsidetests/appsearch/AndroidTest.xml
+++ b/hostsidetests/appsearch/AndroidTest.xml
@@ -28,4 +28,8 @@
         <option name="test-file-name" value="CtsAppSearchHostTestHelperB.apk" />
         <option name="cleanup-apks" value="true" />
     </target_preparer>
+    <object type="module_controller"
+            class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+        <option name="mainline-module-package-name" value="com.google.android.appsearch" />
+    </object>
 </configuration>
diff --git a/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java b/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
index 088dfeb..5d982e5 100644
--- a/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
+++ b/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
@@ -28,7 +28,6 @@
 import com.android.internal.os.StatsdConfigProto.StatsdConfig;
 import com.android.os.AtomsProto;
 import com.android.os.AtomsProto.MediametricsMediaParserReported;
-import com.android.os.StatsLog;
 import com.android.os.StatsLog.ConfigMetricsReportList;
 import com.android.os.StatsLog.EventMetricData;
 import com.android.tradefed.build.IBuildInfo;
@@ -42,9 +41,7 @@
 import com.google.common.io.Files;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -203,12 +200,20 @@
     }
 
     public void testTrackCodecs() throws Exception {
-        String[] expectedCodecs = new String[] {"", "mp4a.40.2"};
         runDeviceTest("testMp4");
-        String trackMimeTypesField = getSingleMediaParserReportedEvent().getTrackCodecs();
-        List<String> actualTrackMimeTypes =
-                Arrays.asList(trackMimeTypesField.split(MEDIAPARSER_METRICS_SEPARATOR));
-        assertThat(actualTrackMimeTypes).containsExactlyElementsIn(expectedCodecs);
+        String trackCodecs = getSingleMediaParserReportedEvent().getTrackCodecs();
+        List<String> actualTrackCodecs =
+                Arrays.asList(trackCodecs.split(MEDIAPARSER_METRICS_SEPARATOR));
+        assertThat(actualTrackCodecs.get(1)).isEqualTo("mp4a.40.2");
+        // In one of MediaParser's updates, the backing ExoPlayer version added support for video
+        // codec parsing, so this test must support both old and new MediaParser versions (in some
+        // Android branches, a new version of the test can run against an older Mainline version).
+        // The old version would output an empty video codec string, and the new version reports the
+        // correct "avc1.64001F" value. The test should pass only in these two cases.
+        String videoCodec = actualTrackCodecs.get(0);
+        if (!videoCodec.isEmpty()) {
+            assertThat(videoCodec).isEqualTo("avc1.64001F");
+        }
     }
 
     public void testAlteredParameters() throws Exception {
diff --git a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileAllowParentLinkingTests.kt b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileAllowParentLinkingTests.kt
index bf226ff..152a2b5 100644
--- a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileAllowParentLinkingTests.kt
+++ b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileAllowParentLinkingTests.kt
@@ -18,6 +18,7 @@
 
 import com.android.bedstead.harrier.BedsteadJUnit4
 import com.android.bedstead.harrier.DeviceState
+import com.android.bedstead.harrier.UserType
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile
 import com.android.bedstead.harrier.annotations.Postsubmit
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser
@@ -27,7 +28,7 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 
-@EnsureHasWorkProfile(forUser = DeviceState.UserType.PRIMARY_USER)
+@EnsureHasWorkProfile(forUser = UserType.PRIMARY_USER)
 @RunWith(BedsteadJUnit4::class)
 class DomainVerificationWorkProfileAllowParentLinkingTests :
     DomainVerificationWorkProfileTestsBase() {
diff --git a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileCrossProfileIntentTests.kt b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileCrossProfileIntentTests.kt
index 4062d98..4586631 100644
--- a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileCrossProfileIntentTests.kt
+++ b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileCrossProfileIntentTests.kt
@@ -21,6 +21,7 @@
 import android.content.IntentFilter
 import com.android.bedstead.harrier.BedsteadJUnit4
 import com.android.bedstead.harrier.DeviceState
+import com.android.bedstead.harrier.UserType
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile
 import com.android.bedstead.harrier.annotations.Postsubmit
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser
@@ -31,7 +32,7 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 
-@EnsureHasWorkProfile(forUser = DeviceState.UserType.PRIMARY_USER)
+@EnsureHasWorkProfile(forUser = UserType.PRIMARY_USER)
 @RunWith(BedsteadJUnit4::class)
 class DomainVerificationWorkProfileCrossProfileIntentTests :
     DomainVerificationWorkProfileTestsBase() {
diff --git a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileTestsBase.kt b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileTestsBase.kt
index dff94b8..21a300a 100644
--- a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileTestsBase.kt
+++ b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkProfileTestsBase.kt
@@ -22,6 +22,7 @@
 import android.net.Uri
 import com.android.bedstead.harrier.BedsteadJUnit4
 import com.android.bedstead.harrier.DeviceState
+import com.android.bedstead.harrier.UserType
 import com.android.bedstead.harrier.annotations.AfterClass
 import com.android.bedstead.harrier.annotations.BeforeClass
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile
@@ -53,7 +54,7 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 
-@EnsureHasWorkProfile(forUser = DeviceState.UserType.PRIMARY_USER)
+@EnsureHasWorkProfile(forUser = UserType.PRIMARY_USER)
 @RunWith(BedsteadJUnit4::class)
 abstract class DomainVerificationWorkProfileTestsBase {
 
@@ -101,7 +102,7 @@
         @BeforeClass
         fun installApks() {
             personalUser = deviceState.primaryUser()
-            workUser = deviceState.workProfile(DeviceState.UserType.PRIMARY_USER)
+            workUser = deviceState.workProfile(UserType.PRIMARY_USER)
             personalBrowsers = collectBrowsers(personalUser)
             workBrowsers = collectBrowsers(workUser)
             TestApis.packages().run {
diff --git a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkUtils.kt b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkUtils.kt
index 955a078..aba31b9 100644
--- a/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkUtils.kt
+++ b/hostsidetests/packagemanager/domainverification/device/multiuser/src/com/android/cts/packagemanager/verify/domain/device/multiuser/DomainVerificationWorkUtils.kt
@@ -19,6 +19,7 @@
 import android.content.Context
 import android.os.UserManager
 import com.android.bedstead.harrier.DeviceState
+import com.android.bedstead.harrier.UserType
 import com.android.bedstead.nene.TestApis
 import com.android.bedstead.nene.users.UserReference
 import android.app.admin.RemoteDevicePolicyManager
@@ -37,7 +38,7 @@
 }
 
 internal fun DeviceState.getWorkDevicePolicyManager() =
-    profileOwner(workProfile(DeviceState.UserType.PRIMARY_USER))!!
+    profileOwner(workProfile(UserType.PRIMARY_USER))!!
             .devicePolicyManager()
 
 internal fun <T> withUserContext(user: UserReference, block: (context: Context) -> T) =
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_0922.java b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_0922.java
deleted file mode 100644
index d8f3ddf..0000000
--- a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_0922.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2021 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;
-
-import static org.junit.Assert.assertTrue;
-import android.platform.test.annotations.AsbSecurityTest;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class CVE_2021_0922 extends SecurityTestCase {
-
-    /**
-     * b/195630721
-     */
-    @AsbSecurityTest(cveBugId = 195630721)
-    @Test
-    public void testPocCVE_2021_0922() throws Exception {
-        String packageName = "com.android.managedprovisioning";
-        String queryStr = "dumpsys package " + packageName;
-        String permissions = AdbUtils.runCommandLine(queryStr, getDevice());
-
-        // MANAGE_APP_OPS_MODES permission must be enforced for
-        // package com.android.managedprovisioning
-        assertTrue(permissions.contains("android.permission.MANAGE_APP_OPS_MODES"));
-    }
-}
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/accessibilityservice/res/values/strings.xml
index 8ec3186..6b577e8 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/accessibilityservice/res/values/strings.xml
@@ -57,34 +57,34 @@
     <string name="accessibility_query_window_test_activity">Query window test</string>
 
     <!-- String Button1 text -->
-    <string name="button1">B1</string>
+    <string name="button1">Btn1</string>
 
     <!-- String Button2 text -->
-    <string name="button2">B2</string>
+    <string name="button2">Btn2</string>
 
     <!-- String Button3 text -->
-    <string name="button3">B3</string>
+    <string name="button3">Btn3</string>
 
     <!-- String Button4 text -->
-    <string name="button4">B4</string>
+    <string name="button4">Btn4</string>
 
     <!-- String Button5 text -->
-    <string name="button5">B5</string>
+    <string name="button5">Btn5</string>
 
     <!-- String Button6 text -->
-    <string name="button6">B6</string>
+    <string name="button6">Btn6</string>
 
     <!-- String with content description for Button6 -->
     <string name="contentDescription">contentDescription</string>
 
     <!-- String Button7 text -->
-    <string name="button7">B7</string>
+    <string name="button7">Btn7</string>
 
     <!-- String Button8 text -->
-    <string name="button8">B8</string>
+    <string name="button8">Btn8</string>
 
     <!-- String Button9 text -->
-    <string name="button9">B9</string>
+    <string name="button9">Btn9</string>
 
     <!-- AccessibilityFocusTest -->
 
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
index 1272745..9484e02 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
@@ -278,7 +278,7 @@
     }
 
     @Test
-    public void testMagnificationServiceShutsDownWhileMagnifying_shouldReturnTo1x() {
+    public void testMagnificationServiceShutsDownWhileMagnifying_fullscreen_shouldReturnTo1x() {
         final MagnificationController controller = mService.getMagnificationController();
         mService.runOnServiceSync(() -> controller.setScale(2.0f, false));
 
@@ -292,6 +292,36 @@
     }
 
     @Test
+    public void testMagnificationServiceShutsDownWhileMagnifying_windowMode_shouldReturnTo1x()
+            throws Exception {
+        final MagnificationController controller = mService.getMagnificationController();
+        final WindowManager windowManager = (WindowManager) mInstrumentation.getContext()
+                .getSystemService(Context.WINDOW_SERVICE);
+        final float scale = 2.0f;
+        final float x = windowManager.getCurrentWindowMetrics().getBounds().centerX();
+        final float y = windowManager.getCurrentWindowMetrics().getBounds().centerX();
+
+        final MagnificationConfig config = new MagnificationConfig.Builder()
+                .setMode(MAGNIFICATION_MODE_WINDOW)
+                .setScale(scale)
+                .setCenterX(x)
+                .setCenterY(y).build();
+
+        mService.runOnServiceSync(() -> {
+            controller.setMagnificationConfig(config, false);
+        });
+        waitUntilMagnificationConfig(controller, x, y);
+
+        mService.runOnServiceSync(() -> mService.disableSelf());
+        mService = null;
+        InstrumentedAccessibilityService service =
+                mInstrumentedAccessibilityServiceRule.enableService();
+        final MagnificationController controller2 = service.getMagnificationController();
+        assertEquals("Magnification must reset when a service dies",
+                1.0f, controller2.getMagnificationConfig().getScale(), 0f);
+    }
+
+    @Test
     public void testGetMagnificationRegion_whenCanControlMagnification_shouldNotBeEmpty() {
         final MagnificationController controller = mService.getMagnificationController();
         Region magnificationRegion = controller.getMagnificationRegion();
diff --git a/tests/app/AndroidManifest.xml b/tests/app/AndroidManifest.xml
index 3e1eb6a..f710c98 100644
--- a/tests/app/AndroidManifest.xml
+++ b/tests/app/AndroidManifest.xml
@@ -25,6 +25,7 @@
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
     <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
     <uses-permission android:name="android.permission.ACCESS_NOTIFICATIONS" />
+    <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
     <uses-permission android:name="android.permission.READ_PROJECTION_STATE" />
     <uses-permission android:name="android.permission.TOGGLE_AUTOMOTIVE_PROJECTION" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
diff --git a/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java b/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
index 5994568..a8b6075 100644
--- a/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
@@ -79,10 +79,10 @@
 public class ActivityManagerFgsBgStartTest {
     private static final String TAG = ActivityManagerFgsBgStartTest.class.getName();
 
-    private static final String STUB_PACKAGE_NAME = "android.app.stubs";
-    private static final String PACKAGE_NAME_APP1 = "com.android.app1";
-    private static final String PACKAGE_NAME_APP2 = "com.android.app2";
-    private static final String PACKAGE_NAME_APP3 = "com.android.app3";
+    static final String STUB_PACKAGE_NAME = "android.app.stubs";
+    static final String PACKAGE_NAME_APP1 = "com.android.app1";
+    static final String PACKAGE_NAME_APP2 = "com.android.app2";
+    static final String PACKAGE_NAME_APP3 = "com.android.app3";
 
     private static final String KEY_DEFAULT_FGS_STARTS_RESTRICTION_ENABLED =
             "default_fgs_starts_restriction_enabled";
@@ -100,7 +100,7 @@
             | PROCESS_CAPABILITY_FOREGROUND_MICROPHONE
             | PROCESS_CAPABILITY_NETWORK);
 
-    private static final int WAITFOR_MSEC = 10000;
+    static final int WAITFOR_MSEC = 10000;
 
     private static final int TEMP_ALLOWLIST_DURATION_MS = 2000;
 
diff --git a/tests/app/src/android/app/cts/BroadcastOptionsTest.java b/tests/app/src/android/app/cts/BroadcastOptionsTest.java
index 45265c5..a63f91b 100644
--- a/tests/app/src/android/app/cts/BroadcastOptionsTest.java
+++ b/tests/app/src/android/app/cts/BroadcastOptionsTest.java
@@ -16,17 +16,30 @@
 
 package android.app.cts;
 
+import static android.app.cts.ActivityManagerFgsBgStartTest.PACKAGE_NAME_APP1;
+import static android.app.cts.ActivityManagerFgsBgStartTest.PACKAGE_NAME_APP2;
+import static android.app.cts.ActivityManagerFgsBgStartTest.WAITFOR_MSEC;
+import static android.app.stubs.LocalForegroundService.ACTION_START_FGS_RESULT;
+
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
+import static org.junit.Assert.assertThrows;
+
 import android.app.BroadcastOptions;
+import android.app.Instrumentation;
+import android.app.cts.android.app.cts.tools.WaitForBroadcast;
+import android.app.stubs.CommandReceiver;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.PowerExemptionManager;
 
+import androidx.test.InstrumentationRegistry;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.compatibility.common.util.SystemUtil;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -175,4 +188,79 @@
         options.setPendingIntentBackgroundActivityLaunchAllowed(false);
         assertFalse(options.isPendingIntentBackgroundActivityLaunchAllowed());
     }
+
+    private void assertBroadcastSuccess(BroadcastOptions options) {
+        final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        final WaitForBroadcast waiter = new WaitForBroadcast(instrumentation.getTargetContext());
+        waiter.prepare(ACTION_START_FGS_RESULT);
+        CommandReceiver.sendCommandWithBroadcastOptions(instrumentation.getContext(),
+                CommandReceiver.COMMAND_START_FOREGROUND_SERVICE,
+                PACKAGE_NAME_APP1, PACKAGE_NAME_APP2, 0, null,
+                options.toBundle());
+        waiter.doWait(WAITFOR_MSEC);
+    }
+
+    private void assertBroadcastFailure(BroadcastOptions options) {
+        final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        final WaitForBroadcast waiter = new WaitForBroadcast(instrumentation.getTargetContext());
+        waiter.prepare(ACTION_START_FGS_RESULT);
+        CommandReceiver.sendCommandWithBroadcastOptions(instrumentation.getContext(),
+                CommandReceiver.COMMAND_START_FOREGROUND_SERVICE,
+                PACKAGE_NAME_APP1, PACKAGE_NAME_APP2, 0, null,
+                options.toBundle());
+        assertThrows(Exception.class, () -> waiter.doWait(WAITFOR_MSEC));
+    }
+
+    @Test
+    public void testRequireCompatChange_simple() {
+        SystemUtil.runWithShellPermissionIdentity(() -> {
+            final int uid = android.os.Process.myUid();
+            final BroadcastOptions options = BroadcastOptions.makeBasic();
+
+            // Default passes
+            assertTrue(options.testRequireCompatChange(uid));
+            assertTrue(cloneViaBundle(options).testRequireCompatChange(uid));
+
+            // Verify both enabled and disabled
+            options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_ENABLED, true);
+            assertTrue(options.testRequireCompatChange(uid));
+            assertTrue(cloneViaBundle(options).testRequireCompatChange(uid));
+            options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_ENABLED, false);
+            assertFalse(options.testRequireCompatChange(uid));
+            assertFalse(cloneViaBundle(options).testRequireCompatChange(uid));
+
+            // And back to default passes
+            options.clearRequireCompatChange();
+            assertTrue(options.testRequireCompatChange(uid));
+            assertTrue(cloneViaBundle(options).testRequireCompatChange(uid));
+        });
+    }
+
+    @Test
+    public void testRequireCompatChange_enabled_success() {
+        final BroadcastOptions options = BroadcastOptions.makeBasic();
+        options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_ENABLED, true);
+        assertBroadcastSuccess(options);
+    }
+
+    @Test
+    public void testRequireCompatChange_enabled_failure() {
+        final BroadcastOptions options = BroadcastOptions.makeBasic();
+        options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_DISABLED, true);
+        assertBroadcastFailure(options);
+    }
+
+    @Test
+    public void testRequireCompatChange_disabled_success() {
+        final BroadcastOptions options = BroadcastOptions.makeBasic();
+        options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_DISABLED, false);
+        assertBroadcastSuccess(options);
+    }
+
+    @Test
+    public void testRequireCompatChange_disabled_failure() {
+        final BroadcastOptions options = BroadcastOptions.makeBasic();
+        options.setRequireCompatChange(BroadcastOptions.CHANGE_ALWAYS_ENABLED, false);
+        assertBroadcastFailure(options);
+    }
 }
diff --git a/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 19dc7a3..b850606 100644
--- a/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -508,7 +508,7 @@
     @Test
     public void testTelephonyFeatures() {
         if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) ||
-            !mPackageManager.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) {
+                !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELECOM)) {
                 return;
         }
 
diff --git a/tests/appsearch/Android.bp b/tests/appsearch/Android.bp
index 8a93269..c17fa34 100644
--- a/tests/appsearch/Android.bp
+++ b/tests/appsearch/Android.bp
@@ -34,6 +34,7 @@
     test_suites: [
         "cts",
         "general-tests",
+        "mts-appsearch",
     ],
     platform_apis: true,
 }
@@ -54,9 +55,8 @@
     ],
     test_suites: [
         "cts",
-        "vts",
-        "vts10",
         "general-tests",
+        "mts-appsearch",
     ],
     manifest: "helper-app/AndroidManifest.xml",
     aaptflags: [
@@ -82,9 +82,8 @@
     ],
     test_suites: [
         "cts",
-        "vts",
-        "vts10",
         "general-tests",
+        "mts-appsearch",
     ],
     manifest: "helper-app/AndroidManifest.xml",
     aaptflags: [
diff --git a/tests/appsearch/AndroidTest.xml b/tests/appsearch/AndroidTest.xml
index 9577159..245569d 100644
--- a/tests/appsearch/AndroidTest.xml
+++ b/tests/appsearch/AndroidTest.xml
@@ -32,4 +32,9 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.cts.appsearch" />
     </test>
+
+    <object type="module_controller"
+            class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+        <option name="mainline-module-package-name" value="com.google.android.appsearch" />
+    </object>
 </configuration>
diff --git a/tests/camera/api31test/src/android/camera/cts/api31test/SPerfClassTest.java b/tests/camera/api31test/src/android/camera/cts/api31test/SPerfClassTest.java
index 447d56b..feb5567 100644
--- a/tests/camera/api31test/src/android/camera/cts/api31test/SPerfClassTest.java
+++ b/tests/camera/api31test/src/android/camera/cts/api31test/SPerfClassTest.java
@@ -206,9 +206,9 @@
     }
 
     /**
-     * Check camera S Performance class requirement for JPEG sizes.
+     * Check JPEG size overrides for devices claiming S Performance class requirement via
+     * Version.MEDIA_PERFORMANCE_CLASS
      */
-    @CddTest(requirement="7.5/H-1-7")
     public void testSPerfClassJpegSizes() throws Exception {
         boolean isSPerfClass = CameraTestUtils.isSPerfClass();
         if (!isSPerfClass) {
diff --git a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index 69f0278..bd9d1c5 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -57,6 +57,7 @@
 import android.media.CamcorderProfile;
 import android.media.ImageReader;
 import android.os.Build;
+import android.platform.test.annotations.AppModeFull;
 import android.util.ArraySet;
 import android.util.Log;
 import android.util.Pair;
@@ -71,7 +72,12 @@
 
 import androidx.test.rule.ActivityTestRule;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
 
 import org.junit.Rule;
 import org.junit.Test;
@@ -86,6 +92,9 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static android.hardware.camera2.cts.CameraTestUtils.MPC_REPORT_LOG_NAME;
+import static android.hardware.camera2.cts.CameraTestUtils.MPC_STREAM_NAME;
+
 /**
  * Extended tests for static camera characteristics.
  */
@@ -2586,6 +2595,7 @@
     /**
      * Check camera orientation against device orientation
      */
+    @AppModeFull(reason = "DeviceStateManager is not accessible to instant apps")
     @CddTest(requirement = "7.5.5/C-1-1")
     @Test
     public void testCameraOrientationAlignedWithDevice() {
@@ -2656,22 +2666,54 @@
     }
 
     /**
+     * If meetPerfClass is true, return perfClassLevel.
+     * Otherwise, return NOT_MET.
+     */
+    private int updatePerfClassLevel(boolean meetPerfClass, int perfClassLevel) {
+        if (!meetPerfClass) {
+            return CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+        } else {
+            return perfClassLevel;
+        }
+    }
+
+    /**
+     * Update perf class level based on meetSPerfClass and meetRPerfClass.
+     */
+    private int updatePerfClassLevel(boolean meetSPerfClass, boolean meetRPerfClass,
+            int perfClassLevel) {
+        if (!meetRPerfClass) {
+            return CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+        } else if (!meetSPerfClass &&
+                perfClassLevel > CameraTestUtils.PERFORMANCE_CLASS_R) {
+            return CameraTestUtils.PERFORMANCE_CLASS_R;
+        }
+        return perfClassLevel;
+    }
+
+    /**
      * Check camera characteristics for R and S Performance class requirements as specified
      * in CDD camera section 7.5
      */
     @Test
-    @CddTest(requirement="7.5")
+    @CddTest(requirement="7.5/H-1-1,H-1-2,H-1-3,H-1-4,H-1-8")
     public void testCameraPerfClassCharacteristics() throws Exception {
         if (mAdoptShellPerm) {
             // Skip test for system camera. Performance class is only applicable for public camera
             // ids.
             return;
         }
-        boolean isRPerfClass = CameraTestUtils.isRPerfClass();
-        boolean isSPerfClass = CameraTestUtils.isSPerfClass();
-        if (!isRPerfClass && !isSPerfClass) {
-            return;
-        }
+        boolean assertRPerfClass = CameraTestUtils.isRPerfClass();
+        boolean assertSPerfClass = CameraTestUtils.isSPerfClass();
+        boolean assertPerfClass = (assertRPerfClass || assertSPerfClass);
+
+        int perfClassLevelH11 = CameraTestUtils.PERFORMANCE_CLASS_CURRENT;
+        int perfClassLevelH12 = CameraTestUtils.PERFORMANCE_CLASS_CURRENT;
+        int perfClassLevelH13 = CameraTestUtils.PERFORMANCE_CLASS_CURRENT;
+        int perfClassLevelH14 = CameraTestUtils.PERFORMANCE_CLASS_CURRENT;
+        int perfClassLevelH18 = CameraTestUtils.PERFORMANCE_CLASS_CURRENT;
+
+        DeviceReportLog reportLog = new DeviceReportLog(MPC_REPORT_LOG_NAME, MPC_STREAM_NAME);
 
         boolean hasPrimaryRear = false;
         boolean hasPrimaryFront = false;
@@ -2700,78 +2742,145 @@
 
             if (isPrimaryRear) {
                 hasPrimaryRear = true;
-                mCollector.expectTrue("Primary rear camera resolution should be at least " +
-                        MIN_BACK_SENSOR_PERF_CLASS_RESOLUTION + " pixels, is "+
-                        sensorResolution,
-                        sensorResolution >= MIN_BACK_SENSOR_PERF_CLASS_RESOLUTION);
+                if (sensorResolution < MIN_BACK_SENSOR_PERF_CLASS_RESOLUTION) {
+                    mCollector.expectTrue("Primary rear camera resolution should be at least " +
+                            MIN_BACK_SENSOR_PERF_CLASS_RESOLUTION + " pixels, is "+
+                            sensorResolution, !assertPerfClass);
+                    perfClassLevelH11 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+                }
+                reportLog.addValue("rear camera resolution", sensorResolution,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
 
                 // 4K @ 30fps
                 boolean supportUHD = videoSizes.contains(UHD);
                 boolean supportDC4K = videoSizes.contains(DC4K);
-                mCollector.expectTrue("Primary rear camera should support 4k video recording",
-                        supportUHD || supportDC4K);
-                if (supportUHD || supportDC4K) {
+                reportLog.addValue("rear camera 4k support", supportUHD | supportDC4K,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
+                if (!supportUHD && !supportDC4K) {
+                    mCollector.expectTrue("Primary rear camera should support 4k video recording",
+                            !assertPerfClass);
+                    perfClassLevelH11 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+                } else {
                     long minFrameDuration = config.getOutputMinFrameDuration(
                             android.media.MediaRecorder.class, supportDC4K ? DC4K : UHD);
-                    mCollector.expectTrue("Primary rear camera should support 4k video @ 30fps",
-                            minFrameDuration < (1e9 / 29.9));
+                    reportLog.addValue("rear camera 4k frame duration", minFrameDuration,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
+                    if (minFrameDuration >= (1e9 / 29.9)) {
+                        mCollector.expectTrue("Primary rear camera should support 4k video @ 30fps",
+                                !assertPerfClass);
+                        perfClassLevelH11 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+                    }
                 }
             } else {
                 hasPrimaryFront = true;
-                if (isSPerfClass) {
+                if (sensorResolution < MIN_FRONT_SENSOR_S_PERF_CLASS_RESOLUTION) {
+                    mCollector.expectTrue("Primary front camera resolution should be at least " +
+                        MIN_FRONT_SENSOR_S_PERF_CLASS_RESOLUTION + " pixels, is "+
+                        sensorResolution, !assertSPerfClass);
+                    perfClassLevelH12 = Math.min(
+                            perfClassLevelH12, CameraTestUtils.PERFORMANCE_CLASS_R);
+                }
+                if (sensorResolution < MIN_FRONT_SENSOR_R_PERF_CLASS_RESOLUTION) {
                     mCollector.expectTrue("Primary front camera resolution should be at least " +
                             MIN_FRONT_SENSOR_S_PERF_CLASS_RESOLUTION + " pixels, is "+
-                            sensorResolution,
-                            sensorResolution >= MIN_FRONT_SENSOR_S_PERF_CLASS_RESOLUTION);
-                } else {
-                    mCollector.expectTrue("Primary front camera resolution should be at least " +
-                            MIN_FRONT_SENSOR_R_PERF_CLASS_RESOLUTION + " pixels, is "+
-                            sensorResolution,
-                            sensorResolution >= MIN_FRONT_SENSOR_R_PERF_CLASS_RESOLUTION);
+                            sensorResolution, !assertRPerfClass);
+                    perfClassLevelH12 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
                 }
+                reportLog.addValue("front camera resolution", sensorResolution,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
+
                 // 1080P @ 30fps
                 boolean supportFULLHD = videoSizes.contains(FULLHD);
-                mCollector.expectTrue("Primary front camera should support 1080P video recording",
-                        supportFULLHD);
-                if (supportFULLHD) {
+                reportLog.addValue("front camera 1080p support", supportFULLHD,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
+                if (!supportFULLHD) {
+                    mCollector.expectTrue(
+                            "Primary front camera should support 1080P video recording",
+                            !assertPerfClass);
+                    perfClassLevelH12 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+                } else {
                     long minFrameDuration = config.getOutputMinFrameDuration(
                             android.media.MediaRecorder.class, FULLHD);
-                    mCollector.expectTrue("Primary front camera should support 1080P video @ 30fps",
-                            minFrameDuration < (1e9 / 29.9));
+                    if (minFrameDuration >= (1e9 / 29.9)) {
+                        mCollector.expectTrue(
+                                "Primary front camera should support 1080P video @ 30fps",
+                                !assertPerfClass);
+                        perfClassLevelH12 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+                    }
+                    reportLog.addValue("front camera 1080p frame duration", minFrameDuration,
+                        ResultType.NEUTRAL, ResultUnit.NONE);
                 }
             }
 
-            String facingString = hasPrimaryRear ? "rear" : "front";
+            String facingString = isPrimaryRear ? "rear" : "front";
             // H-1-3
-            if (isSPerfClass || (isRPerfClass && isPrimaryRear)) {
+            if (assertSPerfClass || (assertRPerfClass && isPrimaryRear)) {
                 mCollector.expectTrue("Primary " + facingString +
                         " camera should be at least FULL, but is " +
                         toStringHardwareLevel(staticInfo.getHardwareLevelChecked()),
                         staticInfo.isHardwareLevelAtLeastFull());
-            } else {
+            } else if (assertRPerfClass) {
                 mCollector.expectTrue("Primary " + facingString +
                         " camera should be at least LIMITED, but is " +
                         toStringHardwareLevel(staticInfo.getHardwareLevelChecked()),
                         staticInfo.isHardwareLevelAtLeastLimited());
             }
 
+            reportLog.addValue(facingString + " camera hardware level",
+                    staticInfo.getHardwareLevelChecked(), ResultType.NEUTRAL, ResultUnit.NONE);
+            if (isPrimaryRear) {
+                perfClassLevelH13 = updatePerfClassLevel(staticInfo.isHardwareLevelAtLeastFull(),
+                        perfClassLevelH13);
+            } else {
+                perfClassLevelH13 = updatePerfClassLevel(staticInfo.isHardwareLevelAtLeastFull(),
+                        staticInfo.isHardwareLevelAtLeastLimited(), perfClassLevelH13);
+            }
+
             // H-1-4
             Integer timestampSource = c.get(CameraCharacteristics.SENSOR_INFO_TIMESTAMP_SOURCE);
+            reportLog.addValue(facingString + " timestampSource",
+                    timestampSource, ResultType.NEUTRAL, ResultUnit.NONE);
+            boolean realtimeTimestamp = (timestampSource != null &&
+                    timestampSource.equals(CameraMetadata.SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME));
             mCollector.expectTrue(
                     "Primary " + facingString + " camera should support real-time timestamp source",
-                    timestampSource != null &&
-                    timestampSource.equals(CameraMetadata.SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME));
+                    !assertPerfClass || realtimeTimestamp);
+            perfClassLevelH14 = updatePerfClassLevel(realtimeTimestamp, perfClassLevelH14);
 
             // H-1-8
-            if (isSPerfClass && isPrimaryRear) {
+            if (isPrimaryRear) {
+                boolean supportRaw = staticInfo.isCapabilitySupported(RAW);
+                reportLog.addValue(facingString + " camera raw support",
+                        supportRaw, ResultType.NEUTRAL, ResultUnit.NONE);
                 mCollector.expectTrue("Primary rear camera should support RAW capability",
-                        staticInfo.isCapabilitySupported(RAW));
+                        !assertSPerfClass || supportRaw);
+                perfClassLevelH18 = updatePerfClassLevel(supportRaw, true /*R*/, perfClassLevelH18);
             }
         }
-        mCollector.expectTrue("There must be a primary rear camera for performance class.",
-                hasPrimaryRear);
-        mCollector.expectTrue("There must be a primary front camera for performance class.",
-                hasPrimaryFront);
+        if (!hasPrimaryRear) {
+            mCollector.expectTrue("There must be a primary rear camera for performance class.",
+                    !assertPerfClass);
+            perfClassLevelH11 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+        }
+        if (!hasPrimaryFront) {
+            mCollector.expectTrue("There must be a primary front camera for performance class.",
+                    !assertPerfClass);
+            perfClassLevelH12 = CameraTestUtils.PERFORMANCE_CLASS_NOT_MET;
+        }
+
+        reportLog.addValue("Version", "0.0.1", ResultType.NEUTRAL, ResultUnit.NONE);
+        final String PERF_CLASS_REQ_NUM_PREFIX = "2.2.7.2/7.5/";
+        reportLog.addValue(PERF_CLASS_REQ_NUM_PREFIX + "H-1-1",
+                perfClassLevelH11, ResultType.NEUTRAL, ResultUnit.NONE);
+        reportLog.addValue(PERF_CLASS_REQ_NUM_PREFIX + "H-1-2",
+                perfClassLevelH12, ResultType.NEUTRAL, ResultUnit.NONE);
+        reportLog.addValue(PERF_CLASS_REQ_NUM_PREFIX + "H-1-3",
+                perfClassLevelH13, ResultType.NEUTRAL, ResultUnit.NONE);
+        reportLog.addValue(PERF_CLASS_REQ_NUM_PREFIX + "H-1-4",
+                perfClassLevelH14, ResultType.NEUTRAL, ResultUnit.NONE);
+        reportLog.addValue(PERF_CLASS_REQ_NUM_PREFIX + "H-1-8",
+                perfClassLevelH18, ResultType.NEUTRAL, ResultUnit.NONE);
+        reportLog.submit(InstrumentationRegistry.getInstrumentation());
     }
 
     /**
diff --git a/tests/camera/src/android/hardware/cts/CameraTest.java b/tests/camera/src/android/hardware/cts/CameraTest.java
index 3ccf8c1..a6d4131 100644
--- a/tests/camera/src/android/hardware/cts/CameraTest.java
+++ b/tests/camera/src/android/hardware/cts/CameraTest.java
@@ -33,6 +33,7 @@
 import android.hardware.cts.helpers.CameraUtils;
 import android.media.CamcorderProfile;
 import android.media.ExifInterface;
+import android.media.MediaActionSound;
 import android.media.MediaRecorder;
 import android.os.Build;
 import android.os.ConditionVariable;
@@ -3484,6 +3485,20 @@
     }
 
     @Test
+    public void testMustPlayShutterSound() throws Exception {
+        for(int id: mCameraIds){
+            Log.v(TAG, "Camera id=" + id);
+            testMustPlayShutterSoundByCamera(id);
+        }
+    }
+
+    private void testMustPlayShutterSoundByCamera(int id) throws Exception {
+        CameraInfo info = new CameraInfo();
+        Camera.getCameraInfo(id, info);
+        assertEquals(info.canDisableShutterSound, !MediaActionSound.mustPlayShutterSound());
+    }
+
+    @Test
     public void testCameraExternalConnected() {
         if (mActivityRule.getActivity().getPackageManager().
                 hasSystemFeature(PackageManager.FEATURE_CAMERA_EXTERNAL) ) {
diff --git a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
index adc56e7..25c0b08 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -139,6 +139,8 @@
 
     public static final String OFFLINE_CAMERA_ID = "offline_camera_id";
     public static final String REPORT_LOG_NAME = "CtsCameraTestCases";
+    public static final String MPC_REPORT_LOG_NAME = "MediaPerformanceClassLogs";
+    public static final String MPC_STREAM_NAME = "CameraCts";
 
     private static final int EXIF_DATETIME_LENGTH = 19;
     private static final int EXIF_DATETIME_ERROR_MARGIN_SEC = 60;
@@ -3742,8 +3744,10 @@
         return zoomRatios;
     }
 
-    private static final int PERFORMANCE_CLASS_R = Build.VERSION_CODES.R;
-    private static final int PERFORMANCE_CLASS_S = Build.VERSION_CODES.R + 1;
+    public static final int PERFORMANCE_CLASS_NOT_MET = 0;
+    public static final int PERFORMANCE_CLASS_R = Build.VERSION_CODES.R;
+    public static final int PERFORMANCE_CLASS_S = Build.VERSION_CODES.R + 1;
+    public static final int PERFORMANCE_CLASS_CURRENT = PERFORMANCE_CLASS_S;
 
     /**
      * Check whether this mobile device is R performance class as defined in CDD
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
index 42453f3..8595c70 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
@@ -16,10 +16,10 @@
 
 package android.devicepolicy.cts;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.PRIMARY_USER;
-import static com.android.bedstead.harrier.DeviceState.UserType.WORK_PROFILE;
 import static com.android.bedstead.harrier.OptionalBoolean.FALSE;
 import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+import static com.android.bedstead.harrier.UserType.PRIMARY_USER;
+import static com.android.bedstead.harrier.UserType.WORK_PROFILE;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java
index 3aaee38..791ca42 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java
@@ -23,8 +23,8 @@
 import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
 import static android.os.UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.PRIMARY_USER;
-import static com.android.bedstead.harrier.DeviceState.UserType.WORK_PROFILE;
+import static com.android.bedstead.harrier.UserType.PRIMARY_USER;
+import static com.android.bedstead.harrier.UserType.WORK_PROFILE;
 import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
 import static com.android.queryable.queries.ActivityQuery.activity;
 import static com.android.queryable.queries.IntentFilterQuery.intentFilter;
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/LockTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/LockTest.java
index ebcef0e..74d8ebc 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/LockTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/LockTest.java
@@ -21,7 +21,7 @@
 import static android.os.Build.VERSION_CODES.N;
 import static android.os.Build.VERSION_CODES.O;
 
-import static com.android.bedstead.harrier.DeviceState.DEFAULT_PASSWORD;
+import static com.android.bedstead.harrier.Defaults.DEFAULT_PASSWORD;
 import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
 import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
 
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java
index 5f029a2..bcebff2 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java
@@ -114,7 +114,7 @@
             BODY_SENSORS
     })
     @Retention(RetentionPolicy.RUNTIME)
-    private @interface DenyablePermissionTestParameter {
+    private @interface DeniablePermissionTestParameter {
     }
 
     private static final String NON_EXISTING_PACKAGE_NAME = "non.existing.package";
@@ -205,7 +205,7 @@
 
     @Test
     @CanSetPolicyTest(policy = SetPermissionGrantState.class)
-    public void denyPermission_setsGrantState(@DenyablePermissionTestParameter String permission) {
+    public void denyPermission_setsGrantState(@DeniablePermissionTestParameter String permission) {
         int existingGrantState = sDeviceState.dpc().devicePolicyManager()
                 .getPermissionGrantState(sDeviceState.dpc().componentName(),
                         sTestApp.packageName(), permission);
@@ -260,7 +260,7 @@
     @Test
     @PositivePolicyTest(policy = SetPermissionGrantState.class)
     public void denyPermission_permissionIsDenied(
-            @DenyablePermissionTestParameter String permission) {
+            @DeniablePermissionTestParameter String permission) {
         int existingGrantState = sDeviceState.dpc().devicePolicyManager()
                 .getPermissionGrantState(sDeviceState.dpc().componentName(),
                         sTestApp.packageName(), permission);
@@ -309,7 +309,7 @@
     @Test
     @NegativePolicyTest(policy = SetPermissionGrantState.class)
     public void denyPermission_doesNotApply_permissionIsNotDenied(
-            @DenyablePermissionTestParameter String permission) {
+            @DeniablePermissionTestParameter String permission) {
         try {
             sTestApp.pkg().grantPermission(TestApis.users().instrumented(), permission);
 
@@ -327,7 +327,7 @@
     @Test
     @NegativePolicyTest(policy = SetPermissionGrantState.class)
     public void grantPermission_doesNotApply_permissionIsNotGranted(
-            @DenyablePermissionTestParameter String permission) {
+            @DeniablePermissionTestParameter String permission) {
         try {
             sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java
index 043b298..e1e89aa 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java
@@ -47,6 +47,7 @@
 import android.util.Size;
 
 import androidx.annotation.Nullable;
+import androidx.test.filters.FlakyTest;
 
 import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges;
 import libcore.junit.util.compat.CoreCompatChangeRule.EnableCompatChanges;
@@ -71,6 +72,7 @@
  * atest CtsWindowManagerDeviceTestCases:CompatChangeTests
  */
 @Presubmit
+@FlakyTest(bugId = 211853730)
 public final class CompatChangeTests extends MultiDisplayTestBase {
     private static final ComponentName RESIZEABLE_PORTRAIT_ACTIVITY =
             component(ResizeablePortraitActivity.class);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
index 1473ab4..2a574fc 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
@@ -23,6 +23,8 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
 import static android.server.wm.CliIntentExtra.extraBool;
 import static android.server.wm.CliIntentExtra.extraString;
 import static android.server.wm.ComponentNameUtils.getActivityName;
@@ -148,11 +150,6 @@
     private static final int ROTATION_180 = 2;
     private static final int ROTATION_270 = 3;
 
-    // Corresponds to ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
-    private static final int ORIENTATION_LANDSCAPE = 0;
-    // Corresponds to ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
-    private static final int ORIENTATION_PORTRAIT = 1;
-
     private static final float FLOAT_COMPARE_EPSILON = 0.005f;
 
     // Corresponds to com.android.internal.R.dimen.config_pictureInPictureMinAspectRatio
@@ -249,10 +246,10 @@
     public void testEnterPipToOtherOrientation() {
         // Launch a portrait only app on the fullscreen stack
         launchActivity(TEST_ACTIVITY,
-                extraString(EXTRA_FIXED_ORIENTATION, String.valueOf(ORIENTATION_PORTRAIT)));
+                extraString(EXTRA_FIXED_ORIENTATION, String.valueOf(SCREEN_ORIENTATION_PORTRAIT)));
         // Launch the PiP activity fixed as landscape
         launchActivity(PIP_ACTIVITY,
-                extraString(EXTRA_PIP_ORIENTATION, String.valueOf(ORIENTATION_LANDSCAPE)));
+                extraString(EXTRA_PIP_ORIENTATION, String.valueOf(SCREEN_ORIENTATION_LANDSCAPE)));
         // Enter PiP, and assert that the PiP is within bounds now that the device is back in
         // portrait
         mBroadcastActionTrigger.doAction(ACTION_ENTER_PIP);
@@ -1083,22 +1080,21 @@
         assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
         // Launch the PiP activity fixed as portrait, and enter picture-in-picture
         launchActivity(PIP_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
-                extraString(EXTRA_PIP_ORIENTATION, String.valueOf(ORIENTATION_PORTRAIT)),
+                extraString(EXTRA_PIP_ORIENTATION, String.valueOf(SCREEN_ORIENTATION_PORTRAIT)),
                 extraString(EXTRA_ENTER_PIP, "true"));
         waitForEnterPip(PIP_ACTIVITY);
         assertPinnedStackExists();
 
         // Request that the orientation is set to landscape
-        mBroadcastActionTrigger.requestOrientationForPip(ORIENTATION_LANDSCAPE);
+        mBroadcastActionTrigger.requestOrientationForPip(SCREEN_ORIENTATION_LANDSCAPE);
 
         // Launch the activity back into fullscreen and ensure that it is now in landscape
         launchActivity(PIP_ACTIVITY);
         waitForExitPipToFullscreen(PIP_ACTIVITY);
         assertPinnedStackDoesNotExist();
-        mWmState.waitForActivityOrientation(PIP_ACTIVITY, ORIENTATION_LANDSCAPE);
-
-        final Task pipActivityTask = mWmState.getTaskByActivity(PIP_ACTIVITY);
-        assertEquals(ORIENTATION_LANDSCAPE, pipActivityTask.mOverrideConfiguration.orientation);
+        assertTrue("The PiP activity in fullscreen must be landscape",
+                mWmState.waitForActivityOrientation(
+                        PIP_ACTIVITY, Configuration.ORIENTATION_LANDSCAPE));
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityStarterTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityStarterTests.java
index 0496bd6..22ef041 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityStarterTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityStarterTests.java
@@ -32,7 +32,6 @@
 import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_TRANSLUCENT_ACTIVITY;
 import static android.server.wm.app.Components.TEST_ACTIVITY;
 import static android.server.wm.lifecycle.LifecycleLog.ActivityCallback.ON_STOP;
-import static android.view.Display.DEFAULT_DISPLAY;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
@@ -40,22 +39,15 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.app.Activity;
-import android.app.WindowConfiguration;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.ActivityLauncher;
-import android.server.wm.WindowManagerState;
 import android.server.wm.app.Components;
-import android.util.Log;
-import android.view.WindowManager;
 
 import org.junit.Test;
 
-import java.util.List;
-import java.util.function.Predicate;
-
 /**
  * Build/Install/Run:
  *     atest CtsWindowManagerDeviceTestCases:ActivityStarterTests
@@ -720,7 +712,7 @@
 
     /**
      * This test case tests behavior of activity with relinquishTaskIdentify attribute. Ensure the
-     * relinquishTaskIdentity doesn't work if the app is not installed in the system partition.
+     * relinquishTaskIdentity work if the activities are in the same app.
      */
     @Test
     public void testActivityWithRelinquishTaskIdentity() {
@@ -741,9 +733,9 @@
 
         // verify the activities are in the same task
         assertEquals("Activity must be in the same task.", taskId, taskId2);
-        // verify the relinquishTaskIdentify function is ignored since it isn't a app that in system
-        // partition
-        assertEquals("Affinity should be same with the package name.",
+        // verify the relinquishTaskIdentify function should work since the activities are in the
+        // same app
+        assertNotEquals("Affinity should not be same with the package name.",
                 RELINQUISHTASKIDENTITY_ACTIVITY.getPackageName(), affinity);
     }
 
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
index 9f3df570..42f5e92 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
@@ -227,16 +227,13 @@
     }
 
     /**
-     * Wait for orientation for the Activity
+     * Wait for the configuration orientation of the Activity.
      */
-    public void waitForActivityOrientation(ComponentName activityName, int orientation) {
-        waitForWithAmState(amState -> {
-            final Task task = amState.getTaskByActivity(activityName);
-            if (task == null) {
-                return false;
-            }
-            return task.mFullConfiguration.orientation == orientation;
-        }, "orientation of " + getActivityName(activityName) + " to be " + orientation);
+    public boolean waitForActivityOrientation(ComponentName activityName, int configOrientation) {
+        return waitForWithAmState(amState -> {
+            final Activity activity = amState.getActivity(activityName);
+            return activity != null && activity.mFullConfiguration.orientation == configOrientation;
+        }, "orientation of " + getActivityName(activityName) + " to be " + configOrientation);
     }
 
     public void waitForDisplayUnfrozen() {
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionEndToEndTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionEndToEndTest.java
index 2e90e94..28e9f92 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionEndToEndTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionEndToEndTest.java
@@ -1976,7 +1976,7 @@
         final int expectedNewCursorPosition = 123;
         final ArrayList<String> expectedSuggestions = new ArrayList<>();
         expectedSuggestions.add("test");
-        final TextAttribute expectedTextAttribute = new TextAttribute.TextAttributeBuilder()
+        final TextAttribute expectedTextAttribute = new TextAttribute.Builder()
                 .setTextConversionSuggestions(expectedSuggestions).build();
         // Intentionally let the app return "false" to confirm that IME still receives "true".
         final boolean returnedResult = false;
@@ -2055,7 +2055,7 @@
             // Now IC#getTextAfterCursor() for the memorized IC should fail fast.
             final ImeEvent result = expectCommand(stream,
                     session.callCommitText("text", 1,
-                            new TextAttribute.TextAttributeBuilder().setTextConversionSuggestions(
+                            new TextAttribute.Builder().setTextConversionSuggestions(
                                     Collections.singletonList("test")).build()),
                     TIMEOUT);
             // CAVEAT: this behavior is a bit questionable and may change in a future version.
@@ -2169,7 +2169,7 @@
         final int expectedNewCursorPosition = 123;
         final ArrayList<String> expectedSuggestions = new ArrayList<>();
         expectedSuggestions.add("test");
-        final TextAttribute expectedTextAttribute = new TextAttribute.TextAttributeBuilder()
+        final TextAttribute expectedTextAttribute = new TextAttribute.Builder()
                 .setTextConversionSuggestions(expectedSuggestions).build();
         // Intentionally let the app return "false" to confirm that IME still receives "true".
         final boolean returnedResult = false;
@@ -2247,7 +2247,7 @@
 
             // Now this API call on the memorized IC should fail fast.
             final ImeCommand command = session.callSetComposingText(
-                    "text", 1, new TextAttribute.TextAttributeBuilder()
+                    "text", 1, new TextAttribute.Builder()
                             .setTextConversionSuggestions(Collections.singletonList("test"))
                             .build());
             final ImeEvent result = expectCommand(stream, command, TIMEOUT);
@@ -2373,7 +2373,7 @@
         final int expectedEnd = 17;
         final ArrayList<String> expectedSuggestions = new ArrayList<>();
         expectedSuggestions.add("test");
-        final TextAttribute expectedTextAttribute = new TextAttribute.TextAttributeBuilder()
+        final TextAttribute expectedTextAttribute = new TextAttribute.Builder()
                 .setTextConversionSuggestions(expectedSuggestions).build();
         // Intentionally let the app return "false" to confirm that IME still receives "true".
         final boolean returnedResult = false;
@@ -2449,7 +2449,7 @@
 
             // Now this API call on the memorized IC should fail fast.
             final ImeCommand command = session.callSetComposingRegion(1, 23,
-                    new TextAttribute.TextAttributeBuilder().setTextConversionSuggestions(
+                    new TextAttribute.Builder().setTextConversionSuggestions(
                             Collections.singletonList("test")).build());
             final ImeEvent result = expectCommand(stream, command, TIMEOUT);
             // CAVEAT: this behavior is a bit questionable and may change in a future version.
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
index 0e1d306..16afd09 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
@@ -83,12 +83,14 @@
 import androidx.test.uiautomator.UiDevice;
 import androidx.test.uiautomator.Until;
 
+import com.android.compatibility.common.util.FeatureUtil;
 import com.android.cts.mockime.ImeEvent;
 import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.ImeLayoutInfo;
 import com.android.cts.mockime.ImeSettings;
 import com.android.cts.mockime.MockImeSession;
 
+import org.junit.Assume;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -567,12 +569,16 @@
     @AppModeFull
     @Test
     public void testImeVisibilityWhenImeTransitionBetweenActivities_Full() throws Exception {
+        // TODO(b/210041952): Temporary disable testing on TV platform until realize how to address.
+        Assume.assumeFalse(FeatureUtil.isTV());
         runImeVisibilityWhenImeTransitionBetweenActivities(false /* instant */);
     }
 
     @AppModeInstant
     @Test
     public void testImeVisibilityWhenImeTransitionBetweenActivities_Instant() throws Exception {
+        // TODO(b/210041952): Temporary disable testing on TV platform until realize how to address.
+        Assume.assumeFalse(FeatureUtil.isTV());
         runImeVisibilityWhenImeTransitionBetweenActivities(true /* instant */);
     }
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/TextAttributeTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/TextAttributeTest.java
index 7192edd..3615e1f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/TextAttributeTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/TextAttributeTest.java
@@ -48,7 +48,7 @@
 
     @Test
     public void testTextAttribute() {
-        final TextAttribute textAttribute = new TextAttribute.TextAttributeBuilder()
+        final TextAttribute textAttribute = new TextAttribute.Builder()
                 .setTextConversionSuggestions(SUGGESTIONS)
                 .setExtras(EXTRA_BUNDLE)
                 .build();
@@ -57,7 +57,7 @@
 
     @Test
     public void testWriteToParcel() {
-        final TextAttribute textAttribute = new TextAttribute.TextAttributeBuilder()
+        final TextAttribute textAttribute = new TextAttribute.Builder()
                 .setTextConversionSuggestions(SUGGESTIONS)
                 .setExtras(EXTRA_BUNDLE)
                 .build();
diff --git a/tests/jdwp/AndroidTest.xml b/tests/jdwp/AndroidTest.xml
index 613aebe..e51a3bb 100644
--- a/tests/jdwp/AndroidTest.xml
+++ b/tests/jdwp/AndroidTest.xml
@@ -38,8 +38,8 @@
         <option name="dalvik-arg" value="--debuggable" />
         <option name="dalvik-arg" value="-Xusejit:true" />
         <option name="dalvik-arg" value="-Djpda.settings.verbose=false" />
-        <option name="dalvik-arg" value="-Djpda.settings.timeout=10000" />
-        <option name="dalvik-arg" value="-Djpda.settings.waitingTime=10000" />
+        <option name="dalvik-arg" value="-Djpda.settings.timeout=20000" />
+        <option name="dalvik-arg" value="-Djpda.settings.waitingTime=20000" />
         <option name="dalvik-arg" value="-Djpda.settings.dumpProcess='/system/xbin/su root /system/bin/logwrapper /system/bin/debuggerd'" />
         <option name="dalvik-arg-adbconnection" value="-Djpda.settings.debuggeeAgentArgument=-agentpath:" />
         <option name="dalvik-arg-adbconnection" value="-Djpda.settings.debuggeeAgentName=libjdwp.so" />
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java b/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java
index 5094d17..952faab 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java
@@ -36,7 +36,7 @@
  * A helper class to test sensor APIs related to sampling rates of SensorEventConnections.
  */
 public class SensorRatePermissionEventConnectionTestHelper {
-    public static final int CAPPED_SAMPLE_RATE_HZ = 220; // Capped rate 200 Hz + 10% headroom
+    public static final int CAPPED_SAMPLE_RATE_HZ = 270; // Capped rate 200 Hz + 10% headroom
     // Set of sensors that are throttled
     public static final ImmutableSet<Integer> CAPPED_SENSOR_TYPE_SET = ImmutableSet.of(
             Sensor.TYPE_ACCELEROMETER,
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/AdvertisingSetParametersTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/AdvertisingSetParametersTest.java
new file mode 100644
index 0000000..2eb80fb
--- /dev/null
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/AdvertisingSetParametersTest.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2021 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.bluetooth.cts;
+
+import static android.bluetooth.BluetoothDevice.PHY_LE_1M;
+import static android.bluetooth.BluetoothDevice.PHY_LE_2M;
+import static android.bluetooth.BluetoothDevice.PHY_LE_CODED;
+import static android.bluetooth.le.AdvertisingSetParameters.INTERVAL_LOW;
+import static android.bluetooth.le.AdvertisingSetParameters.INTERVAL_MAX;
+import static android.bluetooth.le.AdvertisingSetParameters.INTERVAL_MEDIUM;
+import static android.bluetooth.le.AdvertisingSetParameters.INTERVAL_MIN;
+import static android.bluetooth.le.AdvertisingSetParameters.TX_POWER_MAX;
+import static android.bluetooth.le.AdvertisingSetParameters.TX_POWER_MEDIUM;
+import static android.bluetooth.le.AdvertisingSetParameters.TX_POWER_MIN;
+
+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 android.bluetooth.le.AdvertisingSetParameters;
+import android.os.Parcel;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class AdvertisingSetParametersTest {
+
+    @Test
+    public void testCreateFromParcel() {
+        final Parcel parcel = Parcel.obtain();
+        try {
+            AdvertisingSetParameters params = new AdvertisingSetParameters.Builder().build();
+            params.writeToParcel(parcel, 0);
+            parcel.setDataPosition(0);
+            AdvertisingSetParameters paramsFromParcel =
+                    AdvertisingSetParameters.CREATOR.createFromParcel(parcel);
+            assertParamsEquals(params, paramsFromParcel);
+        } finally {
+            parcel.recycle();
+        }
+    }
+
+    @Test
+    public void testDefaultParameters() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder().build();
+
+        assertFalse(params.isConnectable());
+        assertFalse(params.isScannable());
+        assertFalse(params.isLegacy());
+        assertFalse(params.isAnonymous());
+        assertFalse(params.includeTxPower());
+        assertEquals(PHY_LE_1M, params.getPrimaryPhy());
+        assertEquals(PHY_LE_1M, params.getSecondaryPhy());
+        assertEquals(INTERVAL_LOW, params.getInterval());
+        assertEquals(TX_POWER_MEDIUM, params.getTxPowerLevel());
+    }
+
+    @Test
+    public void testIsConnectable() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setConnectable(true)
+                .build();
+        assertTrue(params.isConnectable());
+    }
+
+    @Test
+    public void testIsScannable() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setScannable(true)
+                .build();
+        assertTrue(params.isScannable());
+    }
+
+    @Test
+    public void testIsLegacyMode() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setLegacyMode(true)
+                .build();
+        assertTrue(params.isLegacy());
+    }
+
+    @Test
+    public void testIncludeTxPower() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setIncludeTxPower(true)
+                .build();
+        assertTrue(params.includeTxPower());
+    }
+
+    @Test
+    public void testSetPrimaryPhyWithInvalidValue() {
+        try {
+            // Set invalid value
+            new AdvertisingSetParameters.Builder().setPrimaryPhy(PHY_LE_2M);
+            fail();
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testSetPrimaryPhyWithLE1M() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setPrimaryPhy(PHY_LE_1M)
+                .build();
+        assertEquals(PHY_LE_1M, params.getPrimaryPhy());
+    }
+
+    @Test
+    public void testSetPrimaryPhyWithLECoded() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setPrimaryPhy(PHY_LE_CODED)
+                .build();
+        assertEquals(PHY_LE_CODED, params.getPrimaryPhy());
+    }
+
+    @Test
+    public void testSetSecondaryPhyWithInvalidValue() {
+        int INVALID_SECONDARY_PHY = -1;
+        try {
+            // Set invalid value
+            new AdvertisingSetParameters.Builder().setSecondaryPhy(INVALID_SECONDARY_PHY);
+            fail();
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testSetSecondaryPhyWithLE1M() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setSecondaryPhy(PHY_LE_1M)
+                .build();
+        assertEquals(PHY_LE_1M, params.getSecondaryPhy());
+    }
+
+    @Test
+    public void testSetSecondaryPhyWithLE2M() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setSecondaryPhy(PHY_LE_2M)
+                .build();
+        assertEquals(PHY_LE_2M, params.getSecondaryPhy());
+    }
+
+    @Test
+    public void testSetSecondaryPhyWithLECoded() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setSecondaryPhy(PHY_LE_CODED)
+                .build();
+        assertEquals(PHY_LE_CODED, params.getSecondaryPhy());
+    }
+
+    @Test
+    public void testIntervalWithInvalidValues() {
+        int[] invalidValues = {INTERVAL_MIN - 1, INTERVAL_MAX + 1};
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                // Set invalid value
+                new AdvertisingSetParameters.Builder().setInterval(invalidValues[i]);
+                fail();
+            } catch (IllegalArgumentException e) {
+                // expected
+            }
+        }
+    }
+
+    @Test
+    public void testInterval() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setInterval(INTERVAL_MEDIUM)
+                .build();
+        assertEquals(INTERVAL_MEDIUM, params.getInterval());
+    }
+
+    @Test
+    public void testTxPowerLevelWithInvalidValues() {
+        int[] invalidValues = { TX_POWER_MIN - 1, TX_POWER_MAX + 1 };
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                // Set invalid value
+                new AdvertisingSetParameters.Builder().setTxPowerLevel(TX_POWER_MIN - 1);
+                fail();
+            } catch (IllegalArgumentException e) {
+                // expected
+            }
+        }
+    }
+
+    @Test
+    public void testTxPowerLevel() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder()
+                .setTxPowerLevel(TX_POWER_MEDIUM)
+                .build();
+        assertEquals(TX_POWER_MEDIUM, params.getTxPowerLevel());
+    }
+
+    @Test
+    public void testDescribeContents() {
+        AdvertisingSetParameters params = new AdvertisingSetParameters.Builder().build();
+        assertEquals(0, params.describeContents());
+    }
+
+    private void assertParamsEquals(AdvertisingSetParameters p, AdvertisingSetParameters other) {
+        if (p == null && other == null) {
+            return;
+        }
+
+        if (p == null || other == null) {
+            fail("Cannot compare null with non-null value: p=" + p + ", other=" + other);
+        }
+
+        assertEquals(p.isConnectable(), other.isConnectable());
+        assertEquals(p.isScannable(), other.isScannable());
+        assertEquals(p.isLegacy(), other.isLegacy());
+        assertEquals(p.isAnonymous(), other.isAnonymous());
+        assertEquals(p.includeTxPower(), other.includeTxPower());
+        assertEquals(p.getPrimaryPhy(), other.getPrimaryPhy());
+        assertEquals(p.getSecondaryPhy(), other.getSecondaryPhy());
+        assertEquals(p.getInterval(), other.getInterval());
+        assertEquals(p.getTxPowerLevel(), other.getTxPowerLevel());
+    }
+}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/PeriodicAdvertisingParametersTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/PeriodicAdvertisingParametersTest.java
new file mode 100644
index 0000000..1a8c841
--- /dev/null
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/PeriodicAdvertisingParametersTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2021 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.bluetooth.cts;
+
+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 android.bluetooth.le.PeriodicAdvertisingParameters;
+import android.os.Parcel;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class PeriodicAdvertisingParametersTest {
+
+    // Values copied over from PeriodicAdvertisingParameters class.
+    private static final int INTERVAL_MIN = 80;
+    private static final int INTERVAL_MAX = 65519;
+
+    @Test
+    public void testCreateFromParcel() {
+        final Parcel parcel = Parcel.obtain();
+        try {
+            PeriodicAdvertisingParameters params =
+                    new PeriodicAdvertisingParameters.Builder().build();
+            params.writeToParcel(parcel, 0);
+            parcel.setDataPosition(0);
+            PeriodicAdvertisingParameters paramsFromParcel =
+                    PeriodicAdvertisingParameters.CREATOR.createFromParcel(parcel);
+            assertParamsEquals(params, paramsFromParcel);
+        } finally {
+            parcel.recycle();
+        }
+    }
+
+    @Test
+    public void testDefaultParameters() {
+        PeriodicAdvertisingParameters params = new PeriodicAdvertisingParameters.Builder().build();
+        assertFalse(params.getIncludeTxPower());
+        assertEquals(INTERVAL_MAX, params.getInterval());
+    }
+
+    @Test
+    public void testIncludeTxPower() {
+        PeriodicAdvertisingParameters params =
+                new PeriodicAdvertisingParameters.Builder().setIncludeTxPower(true).build();
+        assertTrue(params.getIncludeTxPower());
+    }
+
+    @Test
+    public void testIntervalWithInvalidValues() {
+        int[] invalidValues = { INTERVAL_MIN - 1, INTERVAL_MAX + 1 };
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                new PeriodicAdvertisingParameters.Builder().setInterval(invalidValues[i]).build();
+                fail();
+            } catch (IllegalArgumentException e) {
+                // expected
+            }
+        }
+    }
+
+    @Test
+    public void testInterval() {
+        PeriodicAdvertisingParameters params =
+                new PeriodicAdvertisingParameters.Builder().setInterval(INTERVAL_MIN).build();
+        assertEquals(INTERVAL_MIN, params.getInterval());
+    }
+
+    @Test
+    public void testDescribeContents() {
+        PeriodicAdvertisingParameters params = new PeriodicAdvertisingParameters.Builder().build();
+        assertEquals(0, params.describeContents());
+    }
+
+    private void assertParamsEquals(PeriodicAdvertisingParameters p,
+            PeriodicAdvertisingParameters other) {
+        if (p == null && other == null) {
+            return;
+        }
+
+        if (p == null || other == null) {
+            fail("Cannot compare null with non-null value: p=" + p + ", other=" + other);
+        }
+
+        assertEquals(p.getIncludeTxPower(), other.getIncludeTxPower());
+        assertEquals(p.getInterval(), other.getInterval());
+    }
+}
diff --git a/tests/tests/car_builtin/src/android/car/cts/builtin/util/EventLogHelperTest.java b/tests/tests/car_builtin/src/android/car/cts/builtin/util/EventLogHelperTest.java
new file mode 100644
index 0000000..90184bc
--- /dev/null
+++ b/tests/tests/car_builtin/src/android/car/cts/builtin/util/EventLogHelperTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 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.car.cts.builtin.util;
+
+import android.car.builtin.util.EventLogHelper;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public final class EventLogHelperTest {
+
+    private static final int TIMEOUT_MS = 60_000;
+
+    @Before
+    public void setup() {
+        LogcatHelper.clearLog();
+    }
+
+    @Test
+    public void testWriteCarHelperStart() {
+        EventLogHelper.writeCarHelperStart();
+
+        assertLogMessage("I car_helper_start:");
+    }
+
+    @Test
+    public void testWriteCarHelperBootPhase() {
+        EventLogHelper.writeCarHelperBootPhase(1);
+
+        assertLogMessage("I car_helper_boot_phase: 1");
+    }
+
+    private void assertLogMessage(String match) {
+        LogcatHelper.assertLogcatMessage(match, TIMEOUT_MS);
+    }
+}
diff --git a/tests/tests/car_builtin/src/android/car/cts/builtin/util/LogcatHelper.java b/tests/tests/car_builtin/src/android/car/cts/builtin/util/LogcatHelper.java
new file mode 100644
index 0000000..b3d22bf
--- /dev/null
+++ b/tests/tests/car_builtin/src/android/car/cts/builtin/util/LogcatHelper.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2021 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.car.cts.builtin.util;
+
+import static org.junit.Assert.fail;
+
+import android.app.UiAutomation;
+import android.os.ParcelFileDescriptor;
+import android.os.SystemClock;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.SystemUtil;
+
+import java.io.BufferedReader;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public final class LogcatHelper {
+
+    private LogcatHelper() {}
+
+    /**
+     * Asserts if a message appears in logcat messages within given timeout.
+     *
+     * @param match to find in the logcat messages
+     * @param timeout for waiting the message
+     */
+    public static void assertLogcatMessage(String match, int timeout) {
+        long startTime = SystemClock.elapsedRealtime();
+        UiAutomation automation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        ParcelFileDescriptor output = automation.executeShellCommand("logcat -b all");
+        FileDescriptor fd = output.getFileDescriptor();
+        FileInputStream fileInputStream = new FileInputStream(fd);
+        try (BufferedReader bufferedReader = new BufferedReader(
+                new InputStreamReader(fileInputStream))) {
+            String line;
+            while ((line = bufferedReader.readLine()) != null) {
+                if (line.contains(match)) {
+                    return;
+                }
+                if ((SystemClock.elapsedRealtime() - startTime) > timeout) {
+                    fail("match" + match + " was not found, Timeout: " + timeout + " ms");
+                }
+            }
+        } catch (IOException e) {
+            fail("match was not found, IO exception: " + e);
+        }
+    }
+
+    /**
+     * Asserts if a message does not appears in logcat messages within given timeout. If the message
+     * appears, then assertion will fail.
+     *
+     * @param match to find in the logcat messages
+     * @param timeout for waiting the message
+     */
+    public static void assertNoLogcatMessage(String match, int timeout) throws Exception {
+        long startTime = SystemClock.elapsedRealtime();
+        UiAutomation automation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        ParcelFileDescriptor output = automation.executeShellCommand("logcat -b all");
+        FileDescriptor fd = output.getFileDescriptor();
+        FileInputStream fileInputStream = new FileInputStream(fd);
+        try (BufferedReader bufferedReader = new BufferedReader(
+                new InputStreamReader(fileInputStream))) {
+            String line;
+            while ((line = bufferedReader.readLine()) != null) {
+                if (line.contains(match)) {
+                    fail("Match was not expected, but found: " + match);
+                }
+                if ((SystemClock.elapsedRealtime() - startTime) > timeout) {
+                    return;
+                }
+            }
+        } catch (IOException e) {
+            fail("match was not found, IO exception: " + e);
+        }
+    }
+
+    /**
+     * Clears all logs.
+     */
+    public static void clearLog() {
+        SystemUtil.runShellCommand("logcat -b all -c");
+    }
+}
diff --git a/tests/tests/car_builtin/src/android/car/cts/builtin/util/SlogfTest.java b/tests/tests/car_builtin/src/android/car/cts/builtin/util/SlogfTest.java
index 292e485..85089e0 100644
--- a/tests/tests/car_builtin/src/android/car/cts/builtin/util/SlogfTest.java
+++ b/tests/tests/car_builtin/src/android/car/cts/builtin/util/SlogfTest.java
@@ -19,14 +19,7 @@
 import static android.car.cts.builtin.util.SlogfTest.Level.ERROR;
 import static android.car.cts.builtin.util.SlogfTest.Level.VERBOSE;
 
-import static org.junit.Assert.fail;
-
-import android.app.UiAutomation;
 import android.car.builtin.util.Slogf;
-import android.os.ParcelFileDescriptor;
-import android.os.SystemClock;
-
-import androidx.test.platform.app.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.SystemUtil;
 
@@ -34,15 +27,9 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.BufferedReader;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
 public final class SlogfTest {
     private static final String TAG = SlogfTest.class.getSimpleName();
-    private static final int TIMEOUT = 60_000;
+    private static final int TIMEOUT_MS = 60_000;
     // wait time for waiting to make sure msg is not logged. Should not be a high value as tests
     // waits for this much time.
     private static final int NOT_LOGGED_WAIT_TIME_MS = 5_000;
@@ -100,7 +87,7 @@
     }
 
     private void clearLog() {
-        SystemUtil.runShellCommand("logcat -b all -c");
+        LogcatHelper.clearLog();
     }
 
     private void setLogLevel(Level level) {
@@ -109,47 +96,11 @@
 
     private void assertNoLogcatMessage(Level level, String msg) throws Exception {
         String match = String.format(LOGCAT_LINE_FORMAT, level.getValue(), TAG, msg);
-        long startTime = SystemClock.elapsedRealtime();
-        UiAutomation automation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
-        ParcelFileDescriptor output = automation.executeShellCommand("logcat");
-        FileDescriptor fd = output.getFileDescriptor();
-        FileInputStream fileInputStream = new FileInputStream(fd);
-        try (BufferedReader bufferedReader = new BufferedReader(
-                new InputStreamReader(fileInputStream))) {
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                if (line.contains(match)) {
-                    fail("Match was not expected, but found: " + match);
-                }
-                if ((SystemClock.elapsedRealtime() - startTime) > NOT_LOGGED_WAIT_TIME_MS) {
-                    return;
-                }
-            }
-        } catch (IOException e) {
-            fail("match was not found, IO exception: " + e);
-        }
+        LogcatHelper.assertNoLogcatMessage(match, NOT_LOGGED_WAIT_TIME_MS);
     }
 
     private void assertLogcatMessage(Level level, String msg) {
         String match = String.format(LOGCAT_LINE_FORMAT, level.getValue(), TAG, msg);
-        long startTime = SystemClock.elapsedRealtime();
-        UiAutomation automation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
-        ParcelFileDescriptor output = automation.executeShellCommand("logcat");
-        FileDescriptor fd = output.getFileDescriptor();
-        FileInputStream fileInputStream = new FileInputStream(fd);
-        try (BufferedReader bufferedReader = new BufferedReader(
-                new InputStreamReader(fileInputStream))) {
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                if (line.contains(match)) {
-                    return;
-                }
-                if ((SystemClock.elapsedRealtime() - startTime) > TIMEOUT) {
-                    fail("match was not found, Timeout: " + TIMEOUT + " ms");
-                }
-            }
-        } catch (IOException e) {
-            fail("match was not found, IO exception: " + e);
-        }
+        LogcatHelper.assertLogcatMessage(match, TIMEOUT_MS);
     }
 }
diff --git a/tests/tests/companion/Android.bp b/tests/tests/companion/Android.bp
index 7a2a79a..22a45e8 100644
--- a/tests/tests/companion/Android.bp
+++ b/tests/tests/companion/Android.bp
@@ -16,18 +16,14 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
-android_test {
-    name: "CtsCompanionDevicesTestCases",
-
-    defaults: ["cts_defaults"],
+android_library {
+    name: "cts-companion-common",
+    srcs: [
+        "common/src/**/*.kt",
+    ],
+    manifest: "common/AndroidManifest.xml",
 
     platform_apis: true,
-
-    libs: [
-        "android.test.runner",
-        "android.test.base",
-    ],
-
     static_libs: [
         "androidx.test.ext.junit",
         "compatibility-device-util-axt",
@@ -35,12 +31,81 @@
         "junit",
         "kotlin-test",
     ],
+    libs: [
+        "android.test.base",
+        "android.test.runner",
+    ],
 
-    srcs: ["src/**/*.kt"],
+    // TODO(b/211264986) Change both SDK versions to T (33) once it's formally defined.
+    min_sdk_version: "current",
+    target_sdk_version: "current",
+}
 
+android_test {
+    name: "CtsCompanionDeviceManagerCoreTestCases",
+    srcs: [
+        "core/src/**/*.kt",
+    ],
+    manifest: "core/AndroidManifest.xml",
+    test_config: "core/AndroidTest.xml",
+
+    platform_apis: true,
+    static_libs: [
+        "androidx.test.ext.junit",
+        "compatibility-device-util-axt",
+        "cts-companion-common",
+        "ctstestrunner-axt",
+        "junit",
+        "kotlin-test",
+    ],
+    libs: [
+        "android.test.base",
+        "android.test.runner",
+    ],
+
+    defaults: ["cts_defaults"],
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
         "general-tests",
     ],
+
+    // TODO(b/211264986) Change both SDK versions to T (33) once it's formally defined.
+    min_sdk_version: "current",
+    target_sdk_version: "current",
+}
+
+android_test {
+    name: "CtsCompanionDeviceManagerUiAutomationTestCases",
+    srcs: [
+        "uiautomation/src/**/*.kt",
+    ],
+    manifest: "uiautomation/AndroidManifest.xml",
+    test_config: "uiautomation/AndroidTest.xml",
+
+    platform_apis: true,
+    static_libs: [
+        "androidx.test.ext.junit",
+        "androidx.test.uiautomator",
+        "compatibility-device-util-axt",
+        "cts-companion-common",
+        "ctstestrunner-axt",
+        "junit",
+        "kotlin-test",
+    ],
+    libs: [
+        "android.test.base",
+        "android.test.runner",
+    ],
+
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+
+    // TODO(b/211264986) Change both SDK versions to T (33) once it's formally defined.
+    min_sdk_version: "current",
+    target_sdk_version: "current",
 }
diff --git a/tests/tests/companion/AndroidManifest.xml b/tests/tests/companion/AndroidManifest.xml
deleted file mode 100644
index 9d9cf0b..0000000
--- a/tests/tests/companion/AndroidManifest.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2016 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.companion.cts">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-
-        <service
-            android:name=".PrimaryCompanionService"
-            android:exported="true"
-            android:label="Primary Companion Service"
-            android:permission="android.permission.BIND_COMPANION_DEVICE_SERVICE">
-            <intent-filter>
-                <action android:name="android.companion.CompanionDeviceService" />
-            </intent-filter>
-
-            <meta-data
-                android:name="primary"
-                android:value="true" />
-        </service>
-
-        <service
-            android:name=".SecondaryCompanionService"
-            android:exported="true"
-            android:label="Secondary Companion Service"
-            android:permission="android.permission.BIND_COMPANION_DEVICE_SERVICE">
-            <intent-filter>
-                <action android:name="android.companion.CompanionDeviceService" />
-            </intent-filter>
-        </service>
-    </application>
-
-    <uses-feature android:name="android.software.companion_device_setup" />
-
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.companion.cts"
-                     android:label="CTS tests of android.companion">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-
-</manifest>
-
diff --git a/tests/tests/companion/README.md b/tests/tests/companion/README.md
new file mode 100644
index 0000000..560f8f7
--- /dev/null
+++ b/tests/tests/companion/README.md
@@ -0,0 +1,14 @@
+CTS tests for `CompanionDeviceManager` are split into 2 modules:
+`CtsCompanionDeviceManagerCoreTestCases` (a.k.a. "Core Tests") and
+`CtsCompanionDeviceManagerUiAutomationTestCases` (a.k.a. "UiAutomation Tests").
+
+The core difference between the two test modules is that `CtsCompanionDeviceManager_Core_TestCases`
+does NOT use `UiAutomation` which makes it:
+- faster
+- suitable for to run on NFFs
+- less prone to flakiness
+- better suitable to run in `PRESUBMIT`.
+
+`CtsCompanionDeviceManager_UiAutomation_TestCases`, on the other hand, uses `UiAutomation` in order
+to test CDM flows end-to-end and is (at least for now) designed to run only on the mobile
+form-factor and requires a discoverable BT device nearby.
diff --git a/tests/tests/companion/common/AndroidManifest.xml b/tests/tests/companion/common/AndroidManifest.xml
new file mode 100644
index 0000000..87acf92
--- /dev/null
+++ b/tests/tests/companion/common/AndroidManifest.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2016 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.companion.cts.common">
+
+    <uses-feature android:name="android.software.companion_device_setup" />
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+
+        <service
+                android:name=".PrimaryCompanionService"
+                android:exported="true"
+                android:label="Primary Companion Service"
+                android:permission="android.permission.BIND_COMPANION_DEVICE_SERVICE">
+            <intent-filter>
+                <action android:name="android.companion.CompanionDeviceService" />
+            </intent-filter>
+
+            <meta-data
+                    android:name="primary"
+                    android:value="true" />
+        </service>
+
+        <service
+                android:name=".SecondaryCompanionService"
+                android:exported="true"
+                android:label="Secondary Companion Service"
+                android:permission="android.permission.BIND_COMPANION_DEVICE_SERVICE">
+            <intent-filter>
+                <action android:name="android.companion.CompanionDeviceService" />
+            </intent-filter>
+        </service>
+
+        <activity
+                android:name=".CompanionActivity"
+                android:exported="false"
+                android:label="Companion Activity"
+                android:launchMode="singleInstance"
+                android:excludeFromRecents="true"/>
+    </application>
+
+</manifest>
+
diff --git a/tests/tests/companion/src/android/companion/cts/AppHelper.kt b/tests/tests/companion/common/src/android/companion/cts/common/AppHelper.kt
similarity index 80%
rename from tests/tests/companion/src/android/companion/cts/AppHelper.kt
rename to tests/tests/companion/common/src/android/companion/cts/common/AppHelper.kt
index 4c92c70..31fe4d6 100644
--- a/tests/tests/companion/src/android/companion/cts/AppHelper.kt
+++ b/tests/tests/companion/common/src/android/companion/cts/common/AppHelper.kt
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.common
 
 import android.app.Instrumentation
 import android.net.MacAddress
-import android.util.Log
-import com.android.compatibility.common.util.SystemUtil
-import java.io.IOException
 import java.lang.UnsupportedOperationException
 
 /** Utility class for interacting with applications via Shell */
@@ -61,15 +58,5 @@
         }
     }
 
-    private fun runShellCommand(cmd: String): String {
-        Log.i(TAG, "Running shell command: '$cmd'")
-        try {
-            val out = SystemUtil.runShellCommand(instrumentation, cmd)
-            Log.i(TAG, "Out:\n$out")
-            return out
-        } catch (e: IOException) {
-            Log.e(TAG, "Error running shell command: $cmd")
-            throw e
-        }
-    }
+    private fun runShellCommand(cmd: String) = instrumentation.runShellCommand(cmd)
 }
\ No newline at end of file
diff --git a/tests/tests/companion/common/src/android/companion/cts/common/CompanionActivity.kt b/tests/tests/companion/common/src/android/companion/cts/common/CompanionActivity.kt
new file mode 100644
index 0000000..fa445f9
--- /dev/null
+++ b/tests/tests/companion/common/src/android/companion/cts/common/CompanionActivity.kt
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.common
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
+import android.content.IntentSender
+import android.os.Bundle
+import android.util.Log
+
+/**
+ * An [Activity] for launching confirmation UI via an [android.content.IntentSender.sendIntent] and
+ * receiving result in [onActivityResult].
+ */
+class CompanionActivity : Activity() {
+    private var result: Pair<Int, Intent?>? = null
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        Log.d(TAG, "$this.onCreate()")
+        super.onCreate(savedInstanceState)
+        unsafeInstance = this
+    }
+
+    override fun onDestroy() {
+        Log.d(TAG, "$this.onDestroy()")
+        unsafeInstance = null
+        super.onDestroy()
+    }
+
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+        Log.i(TAG, "onActivityResult() code=${resultCode.codeToString()}, " +
+                "data=${intent.extras}")
+        result = resultCode to data
+    }
+
+    companion object {
+        private var unsafeInstance: CompanionActivity? = null
+        val instance: CompanionActivity
+            get() = unsafeInstance ?: error("There is no CompanionActivity")
+
+        fun launchAndWait(context: Context) {
+            val intent = Intent(context, CompanionActivity::class.java)
+            intent.addFlags(FLAG_ACTIVITY_NEW_TASK)
+            context.startActivity(intent)
+
+            waitForResult(timeout = 3_000, interval = 100) {
+                unsafeInstance?.takeIf { it.isResumed }
+            } ?: error("CompanionActivity has not appeared")
+        }
+
+        fun startIntentSender(intentSender: IntentSender) =
+                instance.startIntentSenderForResult(intentSender, 0, null, 0, 0, 0)
+
+        fun waitForActivityResult() =
+                waitForResult(timeout = 1_000, interval = 100) { instance.result }
+                    ?: error("onActivityResult() has not been invoked")
+
+        fun finish() = instance.finish()
+
+        fun safeFinish() = unsafeInstance?.finish()
+
+        fun waitUntilGone() = waitFor { unsafeInstance == null }
+    }
+}
+
+private fun Int.codeToString() = when (this) {
+    Activity.RESULT_OK -> "RESULT_OK"
+    Activity.RESULT_CANCELED -> "RESULT_CANCELED"
+    else -> "Unknown"
+} + "($this)"
diff --git a/tests/tests/companion/src/android/companion/cts/CompanionService.kt b/tests/tests/companion/common/src/android/companion/cts/common/CompanionService.kt
similarity index 98%
rename from tests/tests/companion/src/android/companion/cts/CompanionService.kt
rename to tests/tests/companion/common/src/android/companion/cts/common/CompanionService.kt
index c167958..73bf5d1 100644
--- a/tests/tests/companion/src/android/companion/cts/CompanionService.kt
+++ b/tests/tests/companion/common/src/android/companion/cts/common/CompanionService.kt
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.common
 
 import android.companion.AssociationInfo
 import android.companion.CompanionDeviceService
diff --git a/tests/tests/companion/common/src/android/companion/cts/common/Constants.kt b/tests/tests/companion/common/src/android/companion/cts/common/Constants.kt
new file mode 100644
index 0000000..a9a81f3
--- /dev/null
+++ b/tests/tests/companion/common/src/android/companion/cts/common/Constants.kt
@@ -0,0 +1,38 @@
+package android.companion.cts.common
+
+import android.Manifest
+import android.companion.AssociationRequest.DEVICE_PROFILE_APP_STREAMING
+import android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
+import android.companion.AssociationRequest.DEVICE_PROFILE_WATCH
+import android.net.MacAddress
+import java.util.concurrent.Executor
+
+/** Set of all supported CDM Device Profiles. */
+val DEVICE_PROFILES = setOf(
+        DEVICE_PROFILE_WATCH,
+        DEVICE_PROFILE_APP_STREAMING,
+        DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
+)
+
+val DEVICE_PROFILE_TO_NAME = mapOf(
+        DEVICE_PROFILE_WATCH to "WATCH",
+        DEVICE_PROFILE_APP_STREAMING to "APP_STREAMING",
+        DEVICE_PROFILE_AUTOMOTIVE_PROJECTION to "AUTOMOTIVE_PROJECTION"
+)
+
+val DEVICE_PROFILE_TO_PERMISSION = mapOf(
+        DEVICE_PROFILE_WATCH to Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH,
+        DEVICE_PROFILE_APP_STREAMING to
+                Manifest.permission.REQUEST_COMPANION_PROFILE_APP_STREAMING,
+        DEVICE_PROFILE_AUTOMOTIVE_PROJECTION to
+                Manifest.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION
+)
+
+val MAC_ADDRESS_A = MacAddress.fromString("00:00:00:00:00:AA")
+val MAC_ADDRESS_B = MacAddress.fromString("00:00:00:00:00:BB")
+val MAC_ADDRESS_C = MacAddress.fromString("00:00:00:00:00:CC")
+
+const val DEVICE_DISPLAY_NAME_A = "Device A"
+const val DEVICE_DISPLAY_NAME_B = "Device B"
+
+val SIMPLE_EXECUTOR: Executor = Executor { it.run() }
\ No newline at end of file
diff --git a/tests/tests/companion/src/android/companion/cts/RecordingCallback.kt b/tests/tests/companion/common/src/android/companion/cts/common/RecordingCallback.kt
similarity index 82%
rename from tests/tests/companion/src/android/companion/cts/RecordingCallback.kt
rename to tests/tests/companion/common/src/android/companion/cts/common/RecordingCallback.kt
index 29ae424..5d0f313 100644
--- a/tests/tests/companion/src/android/companion/cts/RecordingCallback.kt
+++ b/tests/tests/companion/common/src/android/companion/cts/common/RecordingCallback.kt
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.common
 
 import android.companion.AssociationInfo
 import android.companion.CompanionDeviceManager
-import android.companion.cts.RecordingCallback.CallbackMethod.OnAssociationCreated
-import android.companion.cts.RecordingCallback.CallbackMethod.OnAssociationPending
-import android.companion.cts.RecordingCallback.CallbackMethod.OnDeviceFound
-import android.companion.cts.RecordingCallback.CallbackMethod.OnFailure
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationCreated
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnDeviceFound
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnFailure
 import android.content.IntentSender
 import android.util.Log
 
@@ -49,12 +49,12 @@
         _invocations.add(CallbackMethodInvocation(method, param))
     }
 
-    fun waitForInvocation() {
-        if (!waitFor(timeout = 1000, interval = 100) { invocations.isNotEmpty() })
+    fun waitForInvocation(timeout: Long = 1_000) {
+        if (!waitFor(timeout = timeout, interval = 100) { invocations.isNotEmpty() })
             throw AssertionError("Callback hasn't been invoked")
     }
 
-    fun clearRecordedInvocation() = _invocations.clear()
+    fun clearRecordedInvocations() = _invocations.clear()
 
     enum class CallbackMethod {
         OnDeviceFound, OnAssociationPending, OnAssociationCreated, OnFailure
diff --git a/tests/tests/companion/common/src/android/companion/cts/common/RecordingOnAssociationsChangedListener.kt b/tests/tests/companion/common/src/android/companion/cts/common/RecordingOnAssociationsChangedListener.kt
new file mode 100644
index 0000000..2719472
--- /dev/null
+++ b/tests/tests/companion/common/src/android/companion/cts/common/RecordingOnAssociationsChangedListener.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.common
+
+import android.companion.AssociationInfo
+import android.companion.CompanionDeviceManager
+
+class RecordingOnAssociationsChangedListener
+    : CompanionDeviceManager.OnAssociationsChangedListener {
+    private val _invocations: MutableList<List<AssociationInfo>> = mutableListOf()
+    val invocations: List<List<AssociationInfo>>
+        get() = _invocations
+
+    override fun onAssociationsChanged(associations: List<AssociationInfo>) {
+        _invocations.add(associations)
+    }
+
+    fun waitForInvocation(timeout: Long = 1_000) {
+        if (!waitFor(timeout = timeout, interval = 100) { invocations.isNotEmpty() })
+            throw AssertionError("Callback hasn't been invoked")
+    }
+
+    fun clearRecordedInvocations() = _invocations.clear()
+}
\ No newline at end of file
diff --git a/tests/tests/companion/src/android/companion/cts/TestBase.kt b/tests/tests/companion/common/src/android/companion/cts/common/TestBase.kt
similarity index 79%
rename from tests/tests/companion/src/android/companion/cts/TestBase.kt
rename to tests/tests/companion/common/src/android/companion/cts/common/TestBase.kt
index 502852e..8255803 100644
--- a/tests/tests/companion/src/android/companion/cts/TestBase.kt
+++ b/tests/tests/companion/common/src/android/companion/cts/common/TestBase.kt
@@ -14,8 +14,9 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.common
 
+import android.annotation.CallSuper
 import android.app.Instrumentation
 import android.app.UiAutomation
 import android.companion.AssociationInfo
@@ -25,12 +26,14 @@
 import android.net.MacAddress
 import android.os.SystemClock.sleep
 import android.os.SystemClock.uptimeMillis
+import android.util.Log
 import androidx.test.platform.app.InstrumentationRegistry
+import com.android.compatibility.common.util.SystemUtil
 import org.junit.After
 import org.junit.Assume.assumeTrue
 import org.junit.AssumptionViolatedException
 import org.junit.Before
-import java.util.concurrent.Executor
+import java.io.IOException
 import kotlin.test.assertEquals
 import kotlin.test.assertFalse
 import kotlin.test.assertTrue
@@ -43,12 +46,10 @@
     protected val uiAutomation: UiAutomation = instrumentation.uiAutomation
 
     protected val context: Context = instrumentation.context
-    private val userId = context.userId
+    protected val userId = context.userId
     private val targetPackageName = instrumentation.targetContext.packageName
 
     protected val targetApp = AppHelper(instrumentation, userId, targetPackageName)
-    protected val testApp = AppHelper(
-            instrumentation, userId, TEST_APP_PACKAGE_NAME, TEST_APP_APK_PATH)
 
     protected val pm: PackageManager by lazy { context.packageManager!! }
     private val hasCompanionDeviceSetupFeature by lazy {
@@ -69,12 +70,6 @@
             cdm.allAssociations
         })
 
-        // Make sure test app is installed.
-        with(testApp) {
-            if (!isInstalled()) install()
-            assertTrue("Test app $packageName is not installed") { isInstalled() }
-        }
-
         // Make sure CompanionDeviceServices are not bound.
         assertFalse(PrimaryCompanionService.isBound)
         assertFalse(SecondaryCompanionService.isBound)
@@ -92,7 +87,10 @@
         withShellPermissionIdentity { cdm.disassociateAll() }
     }
 
+    @CallSuper
     protected open fun setUp() {}
+
+    @CallSuper
     protected open fun tearDown() {}
 
     protected fun <T> withShellPermissionIdentity(
@@ -112,21 +110,11 @@
         }
     }
 
-    companion object {
-        val MAC_ADDRESS_A = MacAddress.fromString("00:00:00:00:00:AA")
-        val MAC_ADDRESS_B = MacAddress.fromString("00:00:00:00:00:BB")
-        val MAC_ADDRESS_C = MacAddress.fromString("00:00:00:00:00:CC")
-
-        val SIMPLE_EXECUTOR: Executor = Executor { it.run() }
-    }
-
     private fun CompanionDeviceManager.disassociateAll() =
             allAssociations.forEach { disassociate(it.id) }
 }
 
-const val TAG = "CtsCompanionDevicesTestCases"
-private const val TEST_APP_PACKAGE_NAME = "android.os.cts.companiontestapp"
-private const val TEST_APP_APK_PATH = "/data/local/tmp/cts/companion/CtsCompanionTestApp.apk"
+const val TAG = "CtsCompanionDeviceManagerTestCases"
 
 fun <T> assumeThat(message: String, obj: T, assumption: (T) -> Boolean) {
     if (!assumption(obj)) throw AssumptionViolatedException(message)
@@ -155,3 +143,32 @@
     }
     return true
 }
+
+fun <R> waitForResult(
+    timeout: Long = 10_000,
+    interval: Long = 1_000,
+    block: () -> R
+): R? {
+    val startTime = uptimeMillis()
+    while (true) {
+        val result: R = block()
+        if (result != null) return result
+        sleep(interval)
+        if (uptimeMillis() - startTime > timeout) return null
+    }
+}
+
+fun Instrumentation.runShellCommand(cmd: String): String {
+    Log.i(TAG, "Running shell command: '$cmd'")
+    try {
+        val out = SystemUtil.runShellCommand(this, cmd)
+        Log.i(TAG, "Out:\n$out")
+        return out
+    } catch (e: IOException) {
+        Log.e(TAG, "Error running shell command: $cmd")
+        throw e
+    }
+}
+
+fun Instrumentation.setSystemProp(name: String, value: String) =
+        runShellCommand("setprop $name $value")
\ No newline at end of file
diff --git a/tests/tests/companion/core/AndroidManifest.xml b/tests/tests/companion/core/AndroidManifest.xml
new file mode 100644
index 0000000..048558a
--- /dev/null
+++ b/tests/tests/companion/core/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2021 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.companion.cts.core">
+
+    <instrumentation
+        android:name="androidx.test.runner.AndroidJUnitRunner"
+        android:targetPackage="android.companion.cts.core"
+        android:label="CompanionDeviceManager Core CTS tests">
+
+        <meta-data
+            android:name="listener"
+            android:value="com.android.cts.runner.CtsTestRunListener" />
+    </instrumentation>
+
+</manifest>
+
diff --git a/tests/tests/companion/AndroidTest.xml b/tests/tests/companion/core/AndroidTest.xml
similarity index 87%
rename from tests/tests/companion/AndroidTest.xml
rename to tests/tests/companion/core/AndroidTest.xml
index 52bbb14..21d3dd63 100644
--- a/tests/tests/companion/AndroidTest.xml
+++ b/tests/tests/companion/core/AndroidTest.xml
@@ -13,7 +13,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<configuration description="Configuration for companion Tests">
+<configuration description="Configuration for Core CTS tests for CompanionDeviceManager">
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
@@ -24,21 +24,23 @@
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsCompanionDevicesTestCases.apk" />
+        <option name="test-file-name" value="CtsCompanionDeviceManagerCoreTestCases.apk" />
         <option name="test-file-name" value="CtsCompanionTestApp.apk" />
     </target_preparer>
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.companion.cts" />
+        <option name="package" value="android.companion.cts.core" />
         <option name="runtime-hint" value="1s" />
     </test>
 
-    <!-- Create a temporary directory for test APKs.  -->
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+        <!-- Create a temporary directory for test APKs.  -->
         <option name="run-command" value="mkdir -p /data/local/tmp/cts/companion" />
-        <option name="run-command" value="am wait-for-broadcast-idle" />
         <option name="teardown-command" value="rm -rf /data/local/tmp/cts/companion" />
+
+        <option name="run-command" value="am wait-for-broadcast-idle" />
     </target_preparer>
+
     <!-- Push test APKs into the temporary directory. -->
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="push" value="CtsCompanionTestApp.apk->/data/local/tmp/cts/companion/CtsCompanionTestApp.apk" />
diff --git a/tests/tests/companion/src/android/companion/cts/AssociateSelfManagedTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/AssociateSelfManagedTest.kt
similarity index 93%
rename from tests/tests/companion/src/android/companion/cts/AssociateSelfManagedTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/AssociateSelfManagedTest.kt
index bce1f86..270e560 100644
--- a/tests/tests/companion/src/android/companion/cts/AssociateSelfManagedTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/AssociateSelfManagedTest.kt
@@ -14,13 +14,16 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH
 import android.Manifest.permission.REQUEST_COMPANION_SELF_MANAGED
 import android.companion.AssociationRequest
 import android.companion.AssociationRequest.DEVICE_PROFILE_WATCH
-import android.companion.cts.RecordingCallback.CallbackMethod.OnAssociationCreated
+import android.companion.cts.common.RecordingCallback
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationCreated
+import android.companion.cts.common.SIMPLE_EXECUTOR
+import android.companion.cts.common.assertEmpty
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
@@ -33,13 +36,13 @@
 /**
  * Test CDM APIs for requesting establishing new associations.
  *
- * Run: atest CtsCompanionDevicesTestCases:AssociateSelfManagedTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:AssociateSelfManagedTest
  *
  * @see android.companion.CompanionDeviceManager.associate
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class AssociateSelfManagedTest : TestBase() {
+class AssociateSelfManagedTest : CoreTestBase() {
 
     @Test
     fun test_associate_selfManaged_requiresPermission() {
diff --git a/tests/tests/companion/src/android/companion/cts/AssociateTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/AssociateTest.kt
similarity index 83%
rename from tests/tests/companion/src/android/companion/cts/AssociateTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/AssociateTest.kt
index f1c193c..14b24a0 100644
--- a/tests/tests/companion/src/android/companion/cts/AssociateTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/AssociateTest.kt
@@ -14,10 +14,12 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.companion.AssociationRequest
-import android.companion.cts.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.RecordingCallback
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.SIMPLE_EXECUTOR
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
@@ -28,13 +30,13 @@
 /**
  * Test CDM APIs for requesting establishing new associations.
  *
- * Run: atest CtsCompanionDevicesTestCases:AssociateTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:AssociateTest
  *
  * @see android.companion.CompanionDeviceManager.associate
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class AssociateTest : TestBase() {
+class AssociateTest : CoreTestBase() {
 
     @Test
     fun test_associate() {
diff --git a/tests/tests/companion/src/android/companion/cts/AssociationRequestBuilderTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/AssociationRequestBuilderTest.kt
similarity index 94%
rename from tests/tests/companion/src/android/companion/cts/AssociationRequestBuilderTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/AssociationRequestBuilderTest.kt
index 3ace9d9..e999c86 100644
--- a/tests/tests/companion/src/android/companion/cts/AssociationRequestBuilderTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/AssociationRequestBuilderTest.kt
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.companion.AssociationRequest
 import android.companion.AssociationRequest.DEVICE_PROFILE_WATCH
 import android.companion.BluetoothDeviceFilter
+import android.companion.cts.common.assertEmpty
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -33,7 +34,7 @@
 /**
  * Test [android.companion.AssociationRequest.Builder].
  *
- * Run: atest CtsCompanionDevicesTestCases:AssociationRequestBuilderTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:AssociationRequestBuilderTest
  */
 @RunWith(AndroidJUnit4::class)
 class AssociationRequestBuilderTest {
diff --git a/tests/tests/companion/src/android/companion/cts/AssociationsChangedListenerTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/AssociationsChangedListenerTest.kt
similarity index 60%
rename from tests/tests/companion/src/android/companion/cts/AssociationsChangedListenerTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/AssociationsChangedListenerTest.kt
index 3edf346..4e31211 100644
--- a/tests/tests/companion/src/android/companion/cts/AssociationsChangedListenerTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/AssociationsChangedListenerTest.kt
@@ -14,20 +14,25 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.Manifest.permission.MANAGE_COMPANION_DEVICES
 import android.companion.CompanionDeviceManager
+import android.companion.cts.common.SIMPLE_EXECUTOR
+import android.companion.cts.common.RecordingOnAssociationsChangedListener
+import android.companion.cts.common.MAC_ADDRESS_A
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
+import kotlin.test.assertEquals
 import org.junit.runner.RunWith
 import kotlin.test.assertFailsWith
+import android.companion.cts.common.assertEmpty
 
 /**
  * Test CDM APIs for listening for changes to [android.companion.AssociationInfo].
  *
- * Run: atest CtsCompanionDevicesTestCases:AssociationsChangedListenerTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:AssociationsChangedListenerTest
  *
  * @see android.companion.CompanionDeviceManager.OnAssociationsChangedListener
  * @see android.companion.CompanionDeviceManager.addOnAssociationsChangedListener
@@ -35,7 +40,7 @@
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class AssociationsChangedListenerTest : TestBase() {
+class AssociationsChangedListenerTest : CoreTestBase() {
 
     @Test
     fun test_addOnAssociationsChangedListener_requiresPermission() {
@@ -56,6 +61,35 @@
         }
     }
 
+    @Test
+    fun test_addOnAssociationsChangedListener() {
+        val callback = RecordingOnAssociationsChangedListener()
+
+        withShellPermissionIdentity(MANAGE_COMPANION_DEVICES) {
+            cdm.addOnAssociationsChangedListener(SIMPLE_EXECUTOR, callback)
+        }
+
+        testApp.associate(MAC_ADDRESS_A)
+
+        callback.waitForInvocation()
+
+        callback.invocations[0].let { associations ->
+            assertEquals(actual = associations.size, expected = 1)
+            assertEquals(actual = associations[0].deviceMacAddress, expected = MAC_ADDRESS_A)
+            assertEquals(actual = associations[0].packageName, expected = TEST_APP_PACKAGE_NAME)
+        }
+
+        callback.clearRecordedInvocations()
+
+        withShellPermissionIdentity(MANAGE_COMPANION_DEVICES) {
+            cdm.removeOnAssociationsChangedListener(callback)
+        }
+
+        testApp.disassociate(MAC_ADDRESS_A)
+        // The callback shouldn't get involved after removed the onAssociationsChangedListener.
+        assertEmpty(callback.invocations)
+    }
+
     companion object {
         val NO_OP_LISTENER = CompanionDeviceManager.OnAssociationsChangedListener { }
     }
diff --git a/tests/tests/companion/src/android/companion/cts/AssociationsCleanUpTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/AssociationsCleanUpTest.kt
similarity index 88%
rename from tests/tests/companion/src/android/companion/cts/AssociationsCleanUpTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/AssociationsCleanUpTest.kt
index f1ad316..332816a 100644
--- a/tests/tests/companion/src/android/companion/cts/AssociationsCleanUpTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/AssociationsCleanUpTest.kt
@@ -14,11 +14,17 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.annotation.UserIdInt
 import android.companion.AssociationInfo
 import android.companion.CompanionDeviceManager
+import android.companion.cts.common.AppHelper
+import android.companion.cts.common.MAC_ADDRESS_A
+import android.companion.cts.common.MAC_ADDRESS_B
+import android.companion.cts.common.MAC_ADDRESS_C
+import android.companion.cts.common.assertAssociations
+import android.companion.cts.common.waitFor
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
@@ -28,11 +34,11 @@
  * Tests if associations that belong to a package are removed when the package is uninstalled or its
  * data is cleared.
  *
- * Build/Install/Run: atest CtsCompanionDevicesTestCases:AssociationsCleanUpTest
+ * Build/Install/Run: atest CtsCompanionDeviceManagerCoreTestCases:AssociationsCleanUpTest
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class AssociationsCleanUpTest : TestBase() {
+class AssociationsCleanUpTest : CoreTestBase() {
 
     @Test
     fun test_associationsRemoved_onPackageDataCleared() {
diff --git a/tests/tests/companion/src/android/companion/cts/BasicTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/BasicTest.kt
similarity index 87%
rename from tests/tests/companion/src/android/companion/cts/BasicTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/BasicTest.kt
index 0b33802..198c4ad 100644
--- a/tests/tests/companion/src/android/companion/cts/BasicTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/BasicTest.kt
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -25,11 +25,11 @@
 /**
  * Tests most basic CDM APis.
  *
- * Build/Install/Run: atest CtsCompanionDevicesTestCases:BasicTest
+ * Build/Install/Run: atest CtsCompanionDeviceManagerCoreTestCases:BasicTest
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class BasicTest : TestBase() {
+class BasicTest : CoreTestBase() {
     @Test
     fun test_manager_isNotNull() {
         assertNotNull(cdm)
diff --git a/tests/tests/companion/core/src/android/companion/cts/core/Constants.kt b/tests/tests/companion/core/src/android/companion/cts/core/Constants.kt
new file mode 100644
index 0000000..a25ee93
--- /dev/null
+++ b/tests/tests/companion/core/src/android/companion/cts/core/Constants.kt
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.core
+
+const val TEST_APP_PACKAGE_NAME = "android.os.cts.companiontestapp"
+const val TEST_APP_APK_PATH = "/data/local/tmp/cts/companion/CtsCompanionTestApp.apk"
\ No newline at end of file
diff --git a/tests/tests/companion/core/src/android/companion/cts/core/CoreTestBase.kt b/tests/tests/companion/core/src/android/companion/cts/core/CoreTestBase.kt
new file mode 100644
index 0000000..326d2c4
--- /dev/null
+++ b/tests/tests/companion/core/src/android/companion/cts/core/CoreTestBase.kt
@@ -0,0 +1,22 @@
+package android.companion.cts.core
+
+import android.annotation.CallSuper
+import android.companion.cts.common.AppHelper
+import android.companion.cts.common.TestBase
+import kotlin.test.assertTrue
+
+open class CoreTestBase : TestBase() {
+    protected val testApp = AppHelper(
+            instrumentation, userId, TEST_APP_PACKAGE_NAME, TEST_APP_APK_PATH)
+
+    @CallSuper
+    override fun setUp() {
+        super.setUp()
+
+        // Make sure test app is installed.
+        with(testApp) {
+            if (!isInstalled()) install()
+            assertTrue("Test app $packageName is not installed") { isInstalled() }
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/companion/src/android/companion/cts/DeviceProfilesTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/DeviceProfilesTest.kt
similarity index 81%
rename from tests/tests/companion/src/android/companion/cts/DeviceProfilesTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/DeviceProfilesTest.kt
index 6daf920..eaed946 100644
--- a/tests/tests/companion/src/android/companion/cts/DeviceProfilesTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/DeviceProfilesTest.kt
@@ -1,6 +1,5 @@
-package android.companion.cts
+package android.companion.cts.core
 
-import android.Manifest
 import android.app.role.RoleManager.ROLE_ASSISTANT
 import android.app.role.RoleManager.ROLE_BROWSER
 import android.app.role.RoleManager.ROLE_CALL_REDIRECTION
@@ -12,15 +11,15 @@
 import android.app.role.RoleManager.ROLE_SYSTEM_SUPERVISION
 import android.app.role.RoleManager.ROLE_SYSTEM_WELLBEING
 import android.companion.AssociationRequest
-import android.companion.AssociationRequest.DEVICE_PROFILE_APP_STREAMING
-import android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
-import android.companion.AssociationRequest.DEVICE_PROFILE_WATCH
-import android.companion.cts.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.DEVICE_PROFILE_TO_PERMISSION
+import android.companion.cts.common.RecordingCallback
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.SIMPLE_EXECUTOR
+import android.companion.cts.common.assertEmpty
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
 import org.junit.runner.RunWith
-import java.lang.IllegalArgumentException
 import kotlin.test.assertEquals
 import kotlin.test.assertFailsWith
 import kotlin.test.assertNotNull
@@ -28,7 +27,7 @@
 /**
  * Test CDM device profiles.
  *
- * Run: atest CtsCompanionDevicesTestCases:DeviceProfilesTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:DeviceProfilesTest
  *
  * @see android.companion.AssociationRequest.DEVICE_PROFILE_APP_STREAMING
  * @see android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
@@ -37,13 +36,13 @@
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class DeviceProfilesTest : TestBase() {
+class DeviceProfilesTest : CoreTestBase() {
     /** Test that all supported device profiles require a permission. */
     @Test
     fun test_supportedProfiles() {
         val callback = RecordingCallback()
-        SUPPORTED_PROFILES.forEach { (profile, permission) ->
-            callback.clearRecordedInvocation()
+        DEVICE_PROFILE_TO_PERMISSION.forEach { (profile, permission) ->
+            callback.clearRecordedInvocations()
             val request = buildRequest(deviceProfile = profile)
 
             // Should fail if called without the required permissions.
@@ -54,6 +53,7 @@
             assertEmpty(callback.invocations)
 
             // Should succeed when called with the required permission.
+            assertNotNull(permission, "Profile should require a permission")
             withShellPermissionIdentity(permission) {
                 cdm.associate(request, SIMPLE_EXECUTOR, callback)
             }
@@ -106,14 +106,6 @@
             .build()
 
     companion object {
-        val SUPPORTED_PROFILES = mapOf(
-                DEVICE_PROFILE_WATCH to Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH,
-                DEVICE_PROFILE_APP_STREAMING to
-                        Manifest.permission.REQUEST_COMPANION_PROFILE_APP_STREAMING,
-                DEVICE_PROFILE_AUTOMOTIVE_PROJECTION to
-                        Manifest.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION
-        )
-
         val UNSUPPORTED_PROFILES = setOf(
                 // Each supported device profile is backed by a role. However, other roles should
                 // not be treated as device profiles.
diff --git a/tests/tests/companion/src/android/companion/cts/DisassociateTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/DisassociateTest.kt
similarity index 92%
rename from tests/tests/companion/src/android/companion/cts/DisassociateTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/DisassociateTest.kt
index 2b902da..2184fdc 100644
--- a/tests/tests/companion/src/android/companion/cts/DisassociateTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/DisassociateTest.kt
@@ -14,12 +14,17 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.Manifest.permission.MANAGE_COMPANION_DEVICES
 import android.annotation.UserIdInt
 import android.companion.AssociationInfo
 import android.companion.CompanionDeviceManager
+import android.companion.cts.common.MAC_ADDRESS_A
+import android.companion.cts.common.MAC_ADDRESS_B
+import android.companion.cts.common.MAC_ADDRESS_C
+import android.companion.cts.common.assertAssociations
+import android.companion.cts.common.assertEmpty
 import android.net.MacAddress
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -31,13 +36,13 @@
 /**
  * Test CDM APIs for removing existing associations.
  *
- * Run: atest CtsCompanionDevicesTestCases:DisassociateTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:DisassociateTest
  *
  * @see android.companion.CompanionDeviceManager.disassociate
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class DisassociateTest : TestBase() {
+class DisassociateTest : CoreTestBase() {
     @Test
     fun test_disassociate_sameApp_singleAssociation() = with(targetApp) {
         associate(MAC_ADDRESS_A)
diff --git a/tests/tests/companion/src/android/companion/cts/LegacyDisassociateTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/LegacyDisassociateTest.kt
similarity index 90%
rename from tests/tests/companion/src/android/companion/cts/LegacyDisassociateTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/LegacyDisassociateTest.kt
index e541fac..56fe2b3 100644
--- a/tests/tests/companion/src/android/companion/cts/LegacyDisassociateTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/LegacyDisassociateTest.kt
@@ -14,9 +14,14 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.Manifest.permission.MANAGE_COMPANION_DEVICES
+import android.companion.cts.common.MAC_ADDRESS_A
+import android.companion.cts.common.MAC_ADDRESS_B
+import android.companion.cts.common.MAC_ADDRESS_C
+import android.companion.cts.common.assertAssociations
+import android.companion.cts.common.assertEmpty
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
@@ -26,13 +31,13 @@
 /**
  * Test legacy CDM APIs for removing existing associations (via MAC address)
  *
- * Run: atest CtsCompanionDevicesTestCases:DisassociateTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:DisassociateTest
  *
  * @see android.companion.CompanionDeviceManager.disassociate
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class LegacyDisassociateTest : TestBase() {
+class LegacyDisassociateTest : CoreTestBase() {
     @Test
     fun test_legacy_disassociate_sameApp() = with(targetApp) {
         associate(MAC_ADDRESS_A)
diff --git a/tests/tests/companion/src/android/companion/cts/RetrieveAssociationsTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/RetrieveAssociationsTest.kt
similarity index 92%
rename from tests/tests/companion/src/android/companion/cts/RetrieveAssociationsTest.kt
rename to tests/tests/companion/core/src/android/companion/cts/core/RetrieveAssociationsTest.kt
index 335a5b8..034e815 100644
--- a/tests/tests/companion/src/android/companion/cts/RetrieveAssociationsTest.kt
+++ b/tests/tests/companion/core/src/android/companion/cts/core/RetrieveAssociationsTest.kt
@@ -14,9 +14,14 @@
  * limitations under the License.
  */
 
-package android.companion.cts
+package android.companion.cts.core
 
 import android.Manifest.permission.MANAGE_COMPANION_DEVICES
+import android.companion.cts.common.MAC_ADDRESS_A
+import android.companion.cts.common.MAC_ADDRESS_B
+import android.companion.cts.common.MAC_ADDRESS_C
+import android.companion.cts.common.assertAssociations
+import android.companion.cts.common.assertEmpty
 import android.platform.test.annotations.AppModeFull
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import org.junit.Test
@@ -27,14 +32,14 @@
 /**
  * Test CDM APIs for retrieving the list of existing associations.
  *
- * Run: atest CtsCompanionDevicesTestCases:RetrieveAssociationsTest
+ * Run: atest CtsCompanionDeviceManagerCoreTestCases:RetrieveAssociationsTest
  *
  * @see android.companion.CompanionDeviceManager.getAllAssociations
  * @see android.companion.CompanionDeviceManager.getMyAssociations
  */
 @AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
 @RunWith(AndroidJUnit4::class)
-class RetrieveAssociationsTest : TestBase() {
+class RetrieveAssociationsTest : CoreTestBase() {
 
     @Test
     fun test_getMyAssociations_singleAssociation() = with(targetApp) {
diff --git a/tests/tests/companion/core/src/android/companion/cts/core/SelfPresenceReportingTest.kt b/tests/tests/companion/core/src/android/companion/cts/core/SelfPresenceReportingTest.kt
new file mode 100644
index 0000000..e32a909
--- /dev/null
+++ b/tests/tests/companion/core/src/android/companion/cts/core/SelfPresenceReportingTest.kt
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.core
+
+import android.Manifest.permission.REQUEST_COMPANION_SELF_MANAGED
+import android.companion.AssociationRequest
+import android.companion.cts.common.DEVICE_DISPLAY_NAME_A
+import android.companion.cts.common.DEVICE_DISPLAY_NAME_B
+import android.companion.cts.common.PrimaryCompanionService
+import android.companion.cts.common.RecordingCallback
+import android.companion.cts.common.SIMPLE_EXECUTOR
+import android.companion.cts.common.SecondaryCompanionService
+import android.companion.cts.common.assertEmpty
+import android.companion.cts.common.waitFor
+import android.os.SystemClock.sleep
+import android.platform.test.annotations.AppModeFull
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import org.junit.Ignore
+import org.junit.Test
+import org.junit.runner.RunWith
+import kotlin.test.assertContentEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
+
+/**
+ * Tests CDM APIs for notifying the presence of status of the companion devices for self-managed
+ * associations.
+ *
+ * Build/Install/Run: atest CtsCompanionDeviceManagerCoreTestCases:SelfPresenceReportingTest
+ *
+ * @see android.companion.CompanionDeviceManager.notifyDeviceAppeared
+ * @see android.companion.CompanionDeviceManager.notifyDeviceDisappeared
+ * @see android.companion.CompanionDeviceService.onDeviceAppeared
+ * @see android.companion.CompanionDeviceService.onDeviceDisappeared
+ */
+@AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
+@RunWith(AndroidJUnit4::class)
+class SelfPresenceReportingTest : CoreTestBase() {
+
+    @Test
+    fun test_primaryService_isBound() =
+            withShellPermissionIdentity(REQUEST_COMPANION_SELF_MANAGED) {
+        val associationId = createSelfManagedAssociation(DEVICE_DISPLAY_NAME_A)
+
+        cdm.notifyDeviceAppeared(associationId)
+
+        assertTrue("Both Services - Primary and Secondary - should be bound now") {
+            waitFor(timeout = 1000, interval = 100) {
+                PrimaryCompanionService.isBound && SecondaryCompanionService.isBound
+            }
+        }
+
+        // Check that only the primary services has received the onDeviceAppeared() callback...
+        PrimaryCompanionService.waitAssociationToAppear(associationId)
+        assertContentEquals(
+                actual = PrimaryCompanionService.associationIdsForConnectedDevices,
+                expected = setOf(associationId)
+        )
+        // ... while the non-primary service - has NOT. (Give it 1 more second.)
+        sleep(1000)
+        assertEmpty(SecondaryCompanionService.connectedDevices)
+
+        assertFalse("Both Services - Primary and Secondary - should stay bound") {
+            waitFor(timeout = 3000, interval = 1000) {
+                !PrimaryCompanionService.isBound || !SecondaryCompanionService.isBound
+            }
+        }
+
+        cdm.notifyDeviceDisappeared(associationId)
+
+        // Check that only the primary services has received the onDeviceDisappeared() callback.
+        PrimaryCompanionService.waitAssociationToDisappear(associationId)
+        assertEmpty(PrimaryCompanionService.connectedDevices)
+
+        assertTrue("Both Services - Primary and Secondary - should be unbound now") {
+            waitFor(timeout = 1000, interval = 100) {
+                !PrimaryCompanionService.isBound && !SecondaryCompanionService.isBound
+            }
+        }
+    }
+
+    @Test
+    @Ignore("b/211398735")
+    fun test_multipleDevices_sameApplication() {
+        val idA = createSelfManagedAssociation(DEVICE_DISPLAY_NAME_A)
+        val idB = createSelfManagedAssociation(DEVICE_DISPLAY_NAME_B)
+
+        cdm.notifyDeviceAppeared(idA)
+
+        assertTrue("Both Services - Primary and Secondary - should be bound now") {
+            waitFor(timeout = 1000, interval = 100) {
+                PrimaryCompanionService.isBound && SecondaryCompanionService.isBound
+            }
+        }
+
+        // Check that only the primary services has received the onDeviceAppeared() callback...
+        PrimaryCompanionService.waitAssociationToAppear(idA)
+        assertContentEquals(
+            actual = PrimaryCompanionService.associationIdsForConnectedDevices,
+            expected = setOf(idA)
+        )
+        // ... while the non-primary service - has NOT. (Give it 1 more second.)
+        sleep(1000)
+        assertEmpty(SecondaryCompanionService.connectedDevices)
+
+        cdm.notifyDeviceAppeared(idB)
+
+        // Check that only the primary services has received the onDeviceAppeared() callback...
+        PrimaryCompanionService.waitAssociationToAppear(idB)
+        assertContentEquals(
+            actual = PrimaryCompanionService.associationIdsForConnectedDevices,
+            expected = setOf(idA, idB)
+        )
+
+        // Make sure both services stay bound.
+        assertFalse("Both Services - Primary and Secondary - should stay bound") {
+            waitFor(timeout = 3000, interval = 1000) {
+                !PrimaryCompanionService.isBound || !SecondaryCompanionService.isBound
+            }
+        }
+
+        // "Disconnect" first device (A).
+        cdm.notifyDeviceDisappeared(idA)
+
+        PrimaryCompanionService.waitAssociationToDisappear(idA)
+        // Both services should stay bound for as long as there is at least
+        // one connected device (B).
+        assertFalse("Both Services - Primary and Secondary - should stay bound") {
+            waitFor(timeout = 3000, interval = 1000) {
+                !PrimaryCompanionService.isBound || !SecondaryCompanionService.isBound
+            }
+        }
+
+        // "Disconnect" second device (B).
+        cdm.notifyDeviceDisappeared(idB)
+
+        PrimaryCompanionService.waitAssociationToDisappear(idB)
+        assertTrue("Both Services - Primary and Secondary - should be unbound now") {
+            waitFor(timeout = 1000, interval = 100) {
+                !PrimaryCompanionService.isBound && !SecondaryCompanionService.isBound
+            }
+        }
+    }
+
+    private fun createSelfManagedAssociation(displayName: String): Int {
+        val callback = RecordingCallback()
+        val request: AssociationRequest = AssociationRequest.Builder()
+            .setSelfManaged(true)
+            .setDisplayName(displayName)
+            .build()
+        withShellPermissionIdentity(REQUEST_COMPANION_SELF_MANAGED) {
+            cdm.associate(request, SIMPLE_EXECUTOR, callback)
+        }
+        callback.waitForInvocation()
+        return callback.invocations[0].associationInfo.id
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/companion/src/android/companion/cts/SelfPresenceReportingTest.kt b/tests/tests/companion/src/android/companion/cts/SelfPresenceReportingTest.kt
deleted file mode 100644
index 4c356dd..0000000
--- a/tests/tests/companion/src/android/companion/cts/SelfPresenceReportingTest.kt
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2021 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.companion.cts
-
-import android.Manifest.permission.REQUEST_COMPANION_SELF_MANAGED
-import android.companion.AssociationRequest
-import android.os.SystemClock.sleep
-import android.platform.test.annotations.AppModeFull
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import org.junit.Test
-import org.junit.runner.RunWith
-import kotlin.test.assertContentEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
-
-/**
- * Tests CDM APIs for notifying the presence of status of the companion devices for self-managed
- * associations.
- *
- * Build/Install/Run: atest CtsCompanionDevicesTestCases:SelfPresenceReportingTest
- *
- * @see android.companion.CompanionDeviceManager.notifyDeviceAppeared
- * @see android.companion.CompanionDeviceManager.notifyDeviceDisappeared
- * @see android.companion.CompanionDeviceService.onDeviceAppeared
- * @see android.companion.CompanionDeviceService.onDeviceDisappeared
- */
-@AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
-@RunWith(AndroidJUnit4::class)
-class SelfPresenceReportingTest : TestBase() {
-
-    @Test
-    fun test_primaryService_isBound() =
-            withShellPermissionIdentity(REQUEST_COMPANION_SELF_MANAGED) {
-        val request: AssociationRequest = AssociationRequest.Builder()
-                .setSelfManaged(true)
-                .setDisplayName(DEVICE_DISPLAY_NAME)
-                .build()
-        val callback = RecordingCallback()
-
-        withShellPermissionIdentity(REQUEST_COMPANION_SELF_MANAGED) {
-            cdm.associate(request, SIMPLE_EXECUTOR, callback)
-        }
-        callback.waitForInvocation()
-        val associationId = cdm.myAssociations[0].id
-
-        cdm.notifyDeviceAppeared(associationId)
-
-        assertTrue("Both Services - Primary and Secondary - should be unbound now") {
-            waitFor(timeout = 1000, interval = 100) {
-                PrimaryCompanionService.isBound && SecondaryCompanionService.isBound
-            }
-        }
-
-        // Check that only the primary services has received the onDeviceAppeared() callback...
-        PrimaryCompanionService.waitAssociationToAppear(associationId)
-        assertContentEquals(
-                actual = PrimaryCompanionService.associationIdsForConnectedDevices,
-                expected = setOf(associationId)
-        )
-        // ... while the non-primary service - has NOT. (Give it 1 more second.)
-        sleep(1000)
-        assertEmpty(SecondaryCompanionService.connectedDevices)
-
-        assertFalse("Both Services - Primary and Secondary - should stay bound") {
-            waitFor(timeout = 3000, interval = 1000) {
-                !PrimaryCompanionService.isBound || !SecondaryCompanionService.isBound
-            }
-        }
-
-        cdm.notifyDeviceDisappeared(associationId)
-
-        // Check that only the primary services has received the onDeviceDisappeared() callback.
-        PrimaryCompanionService.waitAssociationToDisappear(associationId)
-        assertEmpty(PrimaryCompanionService.connectedDevices)
-
-        assertTrue("Both Services - Primary and Secondary - should be unbound now") {
-            waitFor(timeout = 1000, interval = 100) {
-                !PrimaryCompanionService.isBound && !SecondaryCompanionService.isBound
-            }
-        }
-    }
-
-    companion object {
-        private const val DEVICE_DISPLAY_NAME = "My device"
-    }
-}
\ No newline at end of file
diff --git a/tests/tests/companion/uiautomation/AndroidManifest.xml b/tests/tests/companion/uiautomation/AndroidManifest.xml
new file mode 100644
index 0000000..a6052fe
--- /dev/null
+++ b/tests/tests/companion/uiautomation/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2016 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.companion.cts.uiautomation">
+
+    <instrumentation
+        android:name="androidx.test.runner.AndroidJUnitRunner"
+        android:targetPackage="android.companion.cts.uiautomation"
+        android:label="CompanionDeviceManager UiAutomation CTS tests">
+
+        <meta-data
+            android:name="listener"
+            android:value="com.android.cts.runner.CtsTestRunListener" />
+    </instrumentation>
+
+</manifest>
+
diff --git a/tests/tests/companion/AndroidTest.xml b/tests/tests/companion/uiautomation/AndroidTest.xml
similarity index 64%
copy from tests/tests/companion/AndroidTest.xml
copy to tests/tests/companion/uiautomation/AndroidTest.xml
index 52bbb14..9982689 100644
--- a/tests/tests/companion/AndroidTest.xml
+++ b/tests/tests/companion/uiautomation/AndroidTest.xml
@@ -13,7 +13,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<configuration description="Configuration for companion Tests">
+<configuration description="Configuration for UiAutomation CTS tests for CompanionDeviceManager">
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
@@ -24,23 +24,16 @@
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsCompanionDevicesTestCases.apk" />
-        <option name="test-file-name" value="CtsCompanionTestApp.apk" />
+        <option name="test-file-name" value="CtsCompanionDeviceManagerUiAutomationTestCases.apk" />
     </target_preparer>
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.companion.cts" />
-        <option name="runtime-hint" value="1s" />
+        <option name="package" value="android.companion.cts.uiautomation" />
     </test>
 
-    <!-- Create a temporary directory for test APKs.  -->
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
-        <option name="run-command" value="mkdir -p /data/local/tmp/cts/companion" />
+        <option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
+        <option name="run-command" value="wm dismiss-keyguard" />
         <option name="run-command" value="am wait-for-broadcast-idle" />
-        <option name="teardown-command" value="rm -rf /data/local/tmp/cts/companion" />
-    </target_preparer>
-    <!-- Push test APKs into the temporary directory. -->
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-        <option name="push" value="CtsCompanionTestApp.apk->/data/local/tmp/cts/companion/CtsCompanionTestApp.apk" />
     </target_preparer>
 </configuration>
diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSelfManagedTest.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSelfManagedTest.kt
new file mode 100644
index 0000000..c75174d
--- /dev/null
+++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSelfManagedTest.kt
@@ -0,0 +1,99 @@
+package android.companion.cts.uiautomation
+
+import android.app.Activity
+import android.companion.AssociationInfo
+import android.companion.AssociationRequest.DEVICE_PROFILE_WATCH
+import android.companion.CompanionDeviceManager
+import android.companion.cts.common.CompanionActivity
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationCreated
+import android.content.Intent
+import android.platform.test.annotations.AppModeFull
+import org.junit.Assume.assumeFalse
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+import kotlin.test.assertContentEquals
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+/**
+ * Tests the Association Flow end-to-end.
+ *
+ * Build/Install/Run:
+ * atest CtsCompanionDeviceManagerUiAutomationTestCases:AssociationEndToEndSelfManagedTest
+ */
+@AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
+@RunWith(Parameterized::class)
+class AssociationEndToEndSelfManagedTest(
+    profile: String?,
+    profilePermission: String?,
+    profileName: String // Used only by the Parameterized test runner for tagging.
+) : UiAutomationTestBase(profile, profilePermission) {
+
+    override fun setUp() {
+        super.setUp()
+
+        // TODO(b/211602270): Add support for WATCH and "null" profiles in the
+        // confirmation UI (the "self-managed" flow variant).
+        assumeFalse(profile == null)
+        assumeFalse(profile == DEVICE_PROFILE_WATCH)
+    }
+
+    @Test
+    fun test_userRejected() = super.test_userRejected(
+            singleDevice = false, selfManaged = true, displayName = DEVICE_DISPLAY_NAME)
+
+    @Test
+    fun test_userDismissed() = super.test_userDismissed(
+            singleDevice = false, selfManaged = true, displayName = DEVICE_DISPLAY_NAME)
+
+    @Test
+    fun test_userConfirmed() {
+        sendRequestAndLaunchConfirmation(selfManaged = true, displayName = DEVICE_DISPLAY_NAME)
+
+        // User "approves" the request.
+        confirmationUi.clickPositiveButton()
+
+        callback.waitForInvocation()
+        // Check callback invocations: there should have been exactly 1 invocation of the
+        // OnAssociationCreated() method.
+        callback.invocations.let {
+            assertEquals(actual = it.size, expected = 1)
+            assertEquals(actual = it[0].method, expected = OnAssociationCreated)
+            assertNotNull(it[0].associationInfo)
+        }
+        val associationFromCallback = callback.invocations[0].associationInfo
+        assertEquals(actual = associationFromCallback.displayName, expected = DEVICE_DISPLAY_NAME)
+
+        // Wait until the Confirmation UI goes away.
+        confirmationUi.waitUntilGone()
+
+        // Check the result code and the data delivered via onActivityResult()
+        val (resultCode: Int, data: Intent?) = CompanionActivity.waitForActivityResult()
+        assertEquals(actual = resultCode, expected = Activity.RESULT_OK)
+        assertNotNull(data)
+        val associationFromActivityResult: AssociationInfo? =
+                data.getParcelableExtra(CompanionDeviceManager.EXTRA_ASSOCIATION)
+        assertNotNull(associationFromActivityResult)
+        // Check that the association reported back via the callback same as the association
+        // delivered via onActivityResult().
+        assertEquals(associationFromCallback, associationFromActivityResult)
+
+        // Make sure getMyAssociations() returns the same association we received via the callback
+        // as well as in onActivityResult()
+        assertContentEquals(actual = cdm.myAssociations, expected = listOf(associationFromCallback))
+    }
+
+    companion object {
+        /**
+         * List of (profile, permission, name) tuples that represent all supported profiles and
+         * null.
+         * Each test will be suffixed with "[profile=<NAME>]", e.g.: "[profile=WATCH]".
+         */
+        @Parameterized.Parameters(name = "profile={2}")
+        @JvmStatic
+        fun parameters() = supportedProfilesAndNull()
+
+        private const val DEVICE_DISPLAY_NAME = "My Device"
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSingleDeviceTest.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSingleDeviceTest.kt
new file mode 100644
index 0000000..a853ae3
--- /dev/null
+++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndSingleDeviceTest.kt
@@ -0,0 +1,55 @@
+package android.companion.cts.uiautomation
+
+import android.platform.test.annotations.AppModeFull
+import org.junit.Ignore
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/**
+ * Tests the Association Flow end-to-end.
+ *
+ * Build/Install/Run:
+ * atest CtsCompanionDeviceManagerUiAutomationTestCases:AssociationEndToEndSingleDeviceTest
+ */
+@AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
+@RunWith(Parameterized::class)
+class AssociationEndToEndSingleDeviceTest(
+    profile: String?,
+    profilePermission: String?,
+    profileName: String // Used only by the Parameterized test runner for tagging.
+) : UiAutomationTestBase(profile, profilePermission) {
+
+    @Test
+    @Ignore("b/211722613")
+    fun test_userRejected() =
+            super.test_userRejected(singleDevice = true, selfManaged = false, displayName = null)
+
+    @Test
+    @Ignore("b/211722613")
+    fun test_userDismissed() =
+            super.test_userDismissed(singleDevice = true, selfManaged = false, displayName = null)
+
+    @Test
+    @Ignore("b/211722613")
+    fun test_timeout() = super.test_timeout(singleDevice = true)
+
+    @Test
+    @Ignore("b/211722613")
+    fun test_userConfirmed() = super.test_userConfirmed_foundDevice(singleDevice = true) {
+        // Wait until a device is found, which should activate the "positive" button, and click on
+        // the button.
+        confirmationUi.waitUntilPositiveButtonIsEnabledAndClick()
+    }
+
+    companion object {
+        /**
+         * List of (profile, permission, name) tuples that represent all supported profiles and
+         * null.
+         * Each test will be suffixed with "[profile=<NAME>]", e.g.: "[profile=WATCH]".
+         */
+        @Parameterized.Parameters(name = "profile={2}")
+        @JvmStatic
+        fun parameters() = supportedProfilesAndNull()
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndTest.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndTest.kt
new file mode 100644
index 0000000..2aafd51
--- /dev/null
+++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/AssociationEndToEndTest.kt
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.uiautomation
+
+import android.companion.AssociationRequest.DEVICE_PROFILE_APP_STREAMING
+import android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
+import android.platform.test.annotations.AppModeFull
+import org.junit.Assume.assumeFalse
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/**
+ * Tests the Association Flow end-to-end.
+ *
+ * Build/Install/Run: atest CtsCompanionDeviceManagerUiAutomationTestCases:AssociationEndToEndTest
+ */
+@AppModeFull(reason = "CompanionDeviceManager APIs are not available to the instant apps.")
+@RunWith(Parameterized::class)
+class AssociationEndToEndTest(
+    profile: String?,
+    profilePermission: String?,
+    profileName: String // Used only by the Parameterized test runner for tagging.
+) : UiAutomationTestBase(profile, profilePermission) {
+
+    override fun setUp() {
+        super.setUp()
+
+        // TODO(b/211590680): Add support for APP_STREAMING and AUTOMOTIVE_PROJECTION in the
+        // confirmation UI (the "multiple devices" flow variant).
+        assumeFalse(profile == DEVICE_PROFILE_APP_STREAMING)
+        assumeFalse(profile == DEVICE_PROFILE_AUTOMOTIVE_PROJECTION)
+    }
+
+    @Test
+    fun test_userRejected() =
+            super.test_userRejected(singleDevice = false, selfManaged = false, displayName = null)
+
+    @Test
+    fun test_userDismissed() =
+            super.test_userDismissed(singleDevice = false, selfManaged = false, displayName = null)
+
+    @Test
+    fun test_userConfirmed() = super.test_userConfirmed_foundDevice(singleDevice = false) {
+        // Wait until at least one device is found and click on it.
+        confirmationUi.waitAndClickOnFirstFoundDevice()
+    }
+
+    @Test
+    fun test_timeout() = super.test_timeout(singleDevice = false)
+
+    companion object {
+        /**
+         * List of (profile, permission, name) tuples that represent all supported profiles and
+         * null.
+         * Each test will be suffixed with "[profile=<NAME>]", e.g.: "[profile=WATCH]".
+         */
+        @Parameterized.Parameters(name = "profile={2}")
+        @JvmStatic
+        fun parameters() = supportedProfilesAndNull()
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/CompanionDeviceManagerUi.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/CompanionDeviceManagerUi.kt
new file mode 100644
index 0000000..cdbdefa
--- /dev/null
+++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/CompanionDeviceManagerUi.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2021 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.companion.cts.uiautomation
+
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.BySelector
+import androidx.test.uiautomator.SearchCondition
+import androidx.test.uiautomator.UiDevice
+import androidx.test.uiautomator.UiObject2
+import androidx.test.uiautomator.Until
+
+class CompanionDeviceManagerUi(private val ui: UiDevice) {
+    val isVisible: Boolean
+        get() = ui.hasObject(CONFIRMATION_UI)
+
+    fun dismiss() {
+        if (!isVisible) return
+        // Pressing back button should close (cancel) confirmation UI.
+        ui.pressBack()
+        waitUntilGone()
+    }
+
+    fun waitUntilVisible() = ui.wait(Until.hasObject(CONFIRMATION_UI), "CDM UI has not appeared.")
+
+    fun waitUntilGone() = ui.waitShort(Until.gone(CONFIRMATION_UI), "CDM UI has not disappeared")
+
+    fun waitAndClickOnFirstFoundDevice() = ui.waitLongAndFind(
+            Until.findObject(DEVICE_LIST_WITH_ITEMS), "Device List not found or empty")
+                    .children[0].click()
+
+    fun waitUntilPositiveButtonIsEnabledAndClick() = ui.waitLongAndFind(
+        Until.findObject(POSITIVE_BUTTON), "Positive button not found or not clickable")
+            .click()
+
+    fun clickPositiveButton() = click(POSITIVE_BUTTON, "Positive button")
+
+    fun clickNegativeButton() = click(NEGATIVE_BUTTON, "Negative button")
+
+    private fun click(selector: BySelector, description: String) = ui.waitShortAndFind(
+            Until.findObject(selector), "$description  is not found")
+            .click()
+
+    companion object {
+        private const val PACKAGE_NAME = "com.android.companiondevicemanager"
+
+        private val CONFIRMATION_UI = By.pkg(PACKAGE_NAME)
+                .res(PACKAGE_NAME, "activity_confirmation")
+
+        private val CLICKABLE_BUTTON =
+                By.pkg(PACKAGE_NAME).clazz(".Button").clickable(true)
+        private val POSITIVE_BUTTON = By.copy(CLICKABLE_BUTTON).res(PACKAGE_NAME, "btn_positive")
+        private val NEGATIVE_BUTTON = By.copy(CLICKABLE_BUTTON).res(PACKAGE_NAME, "btn_negative")
+
+        private val DEVICE_LIST = By.pkg(PACKAGE_NAME).clazz(".ListView")
+                .res(PACKAGE_NAME, "device_list")
+        private val DEVICE_LIST_ITEM = By.pkg(PACKAGE_NAME)
+                .res(PACKAGE_NAME, "list_item_device")
+        private val DEVICE_LIST_WITH_ITEMS = By.copy(DEVICE_LIST)
+                .hasChild(DEVICE_LIST_ITEM)
+    }
+
+    private fun UiDevice.wait(
+        condition: SearchCondition<Boolean>,
+        message: String,
+        timeout: Long = 3_000
+    ) {
+        if (!wait(condition, timeout)) error(message)
+    }
+
+    private fun UiDevice.waitShort(condition: SearchCondition<Boolean>, message: String) =
+            wait(condition, message, 1_000)
+
+    private fun UiDevice.waitAndFind(
+        condition: SearchCondition<UiObject2>,
+        message: String,
+        timeout: Long = 3_000
+    ): UiObject2 =
+            wait(condition, timeout) ?: error(message)
+
+    private fun UiDevice.waitShortAndFind(
+        condition: SearchCondition<UiObject2>,
+        message: String
+    ): UiObject2 = waitAndFind(condition, message, 1_000)
+
+    private fun UiDevice.waitLongAndFind(
+        condition: SearchCondition<UiObject2>,
+        message: String
+    ): UiObject2 = waitAndFind(condition, message, 10_000)
+}
\ No newline at end of file
diff --git a/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt
new file mode 100644
index 0000000..0455397
--- /dev/null
+++ b/tests/tests/companion/uiautomation/src/android/companion/cts/uiautomation/UiAutomationTestBase.kt
@@ -0,0 +1,285 @@
+package android.companion.cts.uiautomation
+
+import android.Manifest
+import android.annotation.CallSuper
+import android.app.Activity
+import android.companion.AssociationInfo
+import android.companion.AssociationRequest
+import android.companion.BluetoothDeviceFilter
+import android.companion.BluetoothDeviceFilterUtils
+import android.companion.CompanionDeviceManager
+import android.companion.DeviceFilter
+import android.companion.cts.common.CompanionActivity
+import android.companion.cts.common.DEVICE_PROFILES
+import android.companion.cts.common.DEVICE_PROFILE_TO_NAME
+import android.companion.cts.common.DEVICE_PROFILE_TO_PERMISSION
+import android.companion.cts.common.RecordingCallback
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationCreated
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnAssociationPending
+import android.companion.cts.common.RecordingCallback.CallbackMethod.OnFailure
+import android.companion.cts.common.SIMPLE_EXECUTOR
+import android.companion.cts.common.TestBase
+import android.companion.cts.common.assertEmpty
+import android.companion.cts.common.setSystemProp
+import android.content.Intent
+import android.net.MacAddress
+import android.os.Parcelable
+import androidx.test.uiautomator.UiDevice
+import org.junit.Assume
+import org.junit.Assume.assumeFalse
+import java.util.regex.Pattern
+import kotlin.test.assertContentEquals
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+open class UiAutomationTestBase(
+    protected val profile: String?,
+    private val profilePermission: String?
+) : TestBase() {
+    private val uiDevice: UiDevice by lazy { UiDevice.getInstance(instrumentation) }
+    protected val confirmationUi by lazy { CompanionDeviceManagerUi(uiDevice) }
+    protected val callback by lazy { RecordingCallback() }
+
+    @CallSuper
+    override fun tearDown() {
+        super.tearDown()
+
+        CompanionActivity.safeFinish()
+        confirmationUi.dismiss()
+
+        restoreDiscoveryTimeout()
+    }
+
+    @CallSuper
+    override fun setUp() {
+        super.setUp()
+
+        assumeFalse(confirmationUi.isVisible)
+        Assume.assumeTrue(CompanionActivity.waitUntilGone())
+        uiDevice.waitForIdle()
+
+        callback.clearRecordedInvocations()
+    }
+
+    protected fun test_userRejected(
+        singleDevice: Boolean = false,
+        selfManaged: Boolean = false,
+        displayName: String? = null
+    ) = test_cancelled(singleDevice, selfManaged, displayName) {
+            // User "rejects" the request.
+            confirmationUi.clickNegativeButton()
+        }
+
+    protected fun test_userDismissed(
+        singleDevice: Boolean = false,
+        selfManaged: Boolean = false,
+        displayName: String? = null
+    ) = test_cancelled(singleDevice, selfManaged, displayName) {
+            // User "dismisses" the request.
+            uiDevice.pressBack()
+        }
+
+    private fun test_cancelled(
+        singleDevice: Boolean,
+        selfManaged: Boolean,
+        displayName: String?,
+        cancelAction: () -> Unit
+    ) {
+        sendRequestAndLaunchConfirmation(singleDevice, selfManaged, displayName)
+
+        cancelAction()
+
+        callback.waitForInvocation()
+        // Check callback invocations: there should have been exactly 1 invocation of the
+        // onFailure() method.
+        callback.invocations.let {
+            assertEquals(actual = it.size, expected = 1)
+            assertEquals(actual = it[0].method, expected = OnFailure)
+            assertEquals(actual = it[0].error, expected = "Cancelled.")
+        }
+
+        // Wait until the Confirmation UI goes away.
+        confirmationUi.waitUntilGone()
+
+        // Check the result code delivered via onActivityResult()
+        val (resultCode: Int, _) = CompanionActivity.waitForActivityResult()
+        assertEquals(actual = resultCode, expected = Activity.RESULT_CANCELED)
+
+        // Make sure no Associations were created.
+        assertEmpty(cdm.myAssociations)
+    }
+
+    protected fun test_timeout(singleDevice: Boolean = false) {
+        // Set discovery timeout to 1 sec.
+        setDiscoveryTimeout(1_000)
+        // Make sure no device will match the request
+        sendRequestAndLaunchConfirmation(
+                singleDevice = singleDevice, deviceFilter = UNMATCHABLE_BT_FILTER)
+
+        // The discovery timeout is 1 sec, but let's give it 2.
+        callback.waitForInvocation(2_000)
+
+        // Check callback invocations: there should have been exactly 1 invocation of the
+        // onFailure() method.
+        callback.invocations.let {
+            assertEquals(actual = it.size, expected = 1)
+            assertEquals(actual = it[0].method, expected = OnFailure)
+            assertEquals(actual = it[0].error, expected = "Timeout.")
+        }
+
+        // Wait until the Confirmation UI goes away.
+        confirmationUi.waitUntilGone()
+
+        // Check the result code delivered via onActivityResult()
+        val (resultCode: Int, _) = CompanionActivity.waitForActivityResult()
+        assertEquals(actual = resultCode, expected = Activity.RESULT_CANCELED)
+
+        // Make sure no Associations were created.
+        assertEmpty(cdm.myAssociations)
+    }
+
+    protected fun test_userConfirmed_foundDevice(
+        singleDevice: Boolean,
+        confirmationAction: () -> Unit
+    ) {
+        sendRequestAndLaunchConfirmation(singleDevice = singleDevice)
+
+        confirmationAction()
+
+        callback.waitForInvocation()
+        // Check callback invocations: there should have been exactly 1 invocation of the
+        // OnAssociationCreated() method.
+        callback.invocations.let {
+            assertEquals(actual = it.size, expected = 1)
+            assertEquals(actual = it[0].method, expected = OnAssociationCreated)
+            assertNotNull(it[0].associationInfo)
+        }
+        val associationFromCallback = callback.invocations[0].associationInfo
+
+        // Wait until the Confirmation UI goes away.
+        confirmationUi.waitUntilGone()
+
+        // Check the result code and the data delivered via onActivityResult()
+        val (resultCode: Int, data: Intent?) = CompanionActivity.waitForActivityResult()
+        assertEquals(actual = resultCode, expected = Activity.RESULT_OK)
+        assertNotNull(data)
+        val associationFromActivityResult: AssociationInfo? =
+                data.getParcelableExtra(CompanionDeviceManager.EXTRA_ASSOCIATION)
+        assertNotNull(associationFromActivityResult)
+        // Check that the association reported back via the callback same as the association
+        // delivered via onActivityResult().
+        assertEquals(associationFromCallback, associationFromActivityResult)
+
+        // Make sure "device data" was included (for backwards compatibility), and that the
+        // MAC address extracted from this data matches the MAC address from AssociationInfo.
+        val deviceFromActivityResult: Parcelable? =
+                data.getParcelableExtra(CompanionDeviceManager.EXTRA_DEVICE)
+        assertNotNull(deviceFromActivityResult)
+
+        val deviceMacAddress =
+                BluetoothDeviceFilterUtils.getDeviceMacAddress(deviceFromActivityResult)
+        assertEquals(actual = MacAddress.fromString(deviceMacAddress),
+                expected = associationFromCallback.deviceMacAddress)
+
+        // Make sure getMyAssociations() returns the same association we received via the callback
+        // as well as in onActivityResult()
+        assertContentEquals(actual = cdm.myAssociations, expected = listOf(associationFromCallback))
+    }
+
+    protected fun sendRequestAndLaunchConfirmation(
+        singleDevice: Boolean = false,
+        selfManaged: Boolean = false,
+        displayName: String? = null,
+        deviceFilter: DeviceFilter<*>? = null
+    ) {
+        val request = AssociationRequest.Builder()
+                .apply {
+                    // Set the single-device flag.
+                    setSingleDevice(singleDevice)
+
+                    // Set the self-managed flag.
+                    setSelfManaged(selfManaged)
+
+                    // Set profile if not null.
+                    profile?.let { setDeviceProfile(it) }
+
+                    // Set display name if not null.
+                    displayName?.let { setDisplayName(it) }
+
+                    // Add device filter if not null.
+                    deviceFilter?.let { addDeviceFilter(it) }
+                }
+                .build()
+        callback.clearRecordedInvocations()
+
+        // If the REQUEST_COMPANION_SELF_MANAGED and/or the profile permission is required:
+        // run with these permissions as the Shell;
+        // otherwise: just call associate().
+        with(getRequiredPermissions(selfManaged)) {
+            if (isNotEmpty()) {
+                withShellPermissionIdentity(*toTypedArray()) {
+                    cdm.associate(request, SIMPLE_EXECUTOR, callback)
+                }
+            } else {
+                cdm.associate(request, SIMPLE_EXECUTOR, callback)
+            }
+        }
+
+        callback.waitForInvocation()
+        // Check callback invocations: there should have been exactly 1 invocation of the
+        // onAssociationPending() method.
+        callback.invocations.let {
+            assertEquals(actual = it.size, expected = 1)
+            assertEquals(actual = it[0].method, expected = OnAssociationPending)
+            assertNotNull(it[0].intentSender)
+        }
+
+        // Get intent sender and clear callback invocations.
+        val pendingConfirmation = callback.invocations[0].intentSender
+        callback.clearRecordedInvocations()
+
+        // Launch CompanionActivity, and then launch confirmation UI from it.
+        CompanionActivity.launchAndWait(context)
+        CompanionActivity.startIntentSender(pendingConfirmation)
+
+        confirmationUi.waitUntilVisible()
+    }
+
+    private fun getRequiredPermissions(selfManaged: Boolean): List<String> =
+            mutableListOf<String>().also {
+                if (selfManaged) it += Manifest.permission.REQUEST_COMPANION_SELF_MANAGED
+                if (profilePermission != null) it += profilePermission
+            }
+
+    private fun setDiscoveryTimeout(timeout: Int) =
+            instrumentation.setSystemProp(SYS_PROP_DEBUG_TIMEOUT, timeout.toString())
+
+    private fun restoreDiscoveryTimeout() = setDiscoveryTimeout(0)
+
+    companion object {
+        /**
+         * List of (profile, permission, name) tuples that represent all supported profiles and
+         * null.
+         */
+        @JvmStatic
+        protected fun supportedProfilesAndNull() = mutableListOf<Array<String?>>().apply {
+            add(arrayOf(null, null, "null"))
+            addAll(supportedProfiles())
+        }
+
+        /** List of (profile, permission, name) tuples that represent all supported profiles. */
+        private fun supportedProfiles(): Collection<Array<String?>> = DEVICE_PROFILES.map {
+            profile ->
+            arrayOf(profile,
+                    DEVICE_PROFILE_TO_PERMISSION[profile]!!,
+                    DEVICE_PROFILE_TO_NAME[profile]!!)
+        }
+
+        private val UNMATCHABLE_BT_FILTER = BluetoothDeviceFilter.Builder()
+                .setAddress("FF:FF:FF:FF:FF:FF")
+                .setNamePattern(Pattern.compile("This Device Does Not Exist"))
+                .build()
+
+        private const val SYS_PROP_DEBUG_TIMEOUT = "debug.cdm.discovery_timeout"
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/content/src/android/content/cts/ContextTest.java b/tests/tests/content/src/android/content/cts/ContextTest.java
index 913c3a1..b742cc9 100644
--- a/tests/tests/content/src/android/content/cts/ContextTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextTest.java
@@ -1809,6 +1809,31 @@
     }
 
     /**
+     * Verifies a receiver registered with {@link Context#RECEIVER_EXPORTED_UNAUDITED} can receive
+     * a broadcast from an external app.
+     *
+     * <p>{@code Context#RECEIVER_EXPORTED_UNAUDITED} is only intended to be applied to receivers
+     * that have not yet been audited to determine their intended exported state; this test ensures
+     * this flag maintains the existing behavior of exporting the receiver until it can be
+     * evaluated.
+     */
+    public void testRegisterReceiver_exportedUnaudited_broadcastReceived() throws Exception {
+        final ResultReceiver receiver = new ResultReceiver();
+        registerBroadcastReceiver(receiver, new IntentFilter(ResultReceiver.MOCK_ACTION),
+                Context.RECEIVER_EXPORTED_UNAUDITED);
+
+        SystemUtil.runShellCommand(EXTERNAL_APP_BROADCAST_COMMAND);
+
+        new PollingCheck(BROADCAST_TIMEOUT, "The broadcast to the exported receiver"
+                + " was not received within the timeout window") {
+            @Override
+            protected boolean check() {
+                return receiver.hasReceivedBroadCast();
+            }
+        }.run();
+    }
+
+    /**
      * Verifies a receiver registered with {@link Context#RECEIVER_NOT_EXPORTED} does not receive
      * a broadcast from an external app.
      */
diff --git a/tests/tests/graphics/assets/fonts/layout/hyphenation.ttx b/tests/tests/graphics/assets/fonts/layout/hyphenation.ttx
index 20ca0e7..ab9df55 100644
--- a/tests/tests/graphics/assets/fonts/layout/hyphenation.ttx
+++ b/tests/tests/graphics/assets/fonts/layout/hyphenation.ttx
@@ -157,6 +157,29 @@
         <map code="0x0079" name="1em" /> <!-- y -->
         <map code="0x007A" name="1em" /> <!-- z -->
 
+        <map code="0X00ED" name="1em" /> <!-- í -->
+
+        <map code="0X0101" name="1em" /> <!-- ā -->
+
+        <map code="0X016B" name="1em" /> <!-- ū -->
+
+        <map code="0X0423" name="1em" /> <!-- У -->
+        <map code="0X0432" name="1em" /> <!-- в -->
+        <map code="0X043A" name="1em" /> <!-- к -->
+        <map code="0X043C" name="1em" /> <!-- м -->
+        <map code="0X043D" name="1em" /> <!-- н -->
+        <map code="0X0442" name="1em" /> <!-- т -->
+        <map code="0X044C" name="1em" /> <!-- ь -->
+        <map code="0X0456" name="1em" /> <!-- і -->
+
+        <map code="0x1218" name="1em" /> <!-- መ -->
+        <map code="0x1260" name="1em" /> <!-- በ -->
+        <map code="0x1278" name="1em" /> <!-- ቸ -->
+        <map code="0x1295" name="1em" /> <!-- ን -->
+        <map code="0x12CD" name="1em" /> <!-- ው -->
+        <map code="0x12DB" name="1em" /> <!-- ዛ -->
+        <map code="0x130B" name="1em" /> <!-- ጋ -->
+
         <map code="0x2010" name="2em" /> <!-- HYPHEN -->
         <map code="0x058A" name="3em" /> <!-- ARMENIAN HYPHEN -->
         <map code="0x05BE" name="4em" /> <!-- MAQAF -->
diff --git a/tests/tests/graphics/assets/fonts/layout/linebreak.ttf b/tests/tests/graphics/assets/fonts/layout/linebreak.ttf
index fbaea00..be95dc5 100644
--- a/tests/tests/graphics/assets/fonts/layout/linebreak.ttf
+++ b/tests/tests/graphics/assets/fonts/layout/linebreak.ttf
Binary files differ
diff --git a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
index 2e39c1b..7fb066a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
@@ -162,17 +162,17 @@
         Rect outRect = new Rect();
         outline.setOval(0, 0, 50, 51); // different x & y radii, so not round rect
         assertFalse(outline.getRect(outRect)); // not round rect, doesn't work
-        assertFalse(outline.canClip()); // not round rect, doesn't work
+        assertTrue(outline.canClip());
         assertFalse(outline.isEmpty());
 
         outline.setOval(0, 0, 50, 50); // same x & y radii, so round rect
         assertTrue(outline.getRect(outRect)); // is round rect, so works
-        assertTrue(outline.canClip()); // is round rect, so works
+        assertTrue(outline.canClip());
         assertFalse(outline.isEmpty());
 
         outline.setOval(new Rect(0, 0, 50, 50)); // same x & y radii, so round rect
         assertTrue(outline.getRect(outRect)); // is round rect, so works
-        assertTrue(outline.canClip()); // is round rect, so works
+        assertTrue(outline.canClip());
         assertFalse(outline.isEmpty());
     }
 
@@ -187,6 +187,8 @@
 
         path.addCircle(50, 50, 50, Path.Direction.CW);
         outline.setPath(path);
+        assertTrue(outline.canClip());
+
         assertFalse(outline.isEmpty());
     }
 
diff --git a/tests/tests/graphics/src/android/graphics/text/cts/HyphenationTest.java b/tests/tests/graphics/src/android/graphics/text/cts/HyphenationTest.java
new file mode 100644
index 0000000..a424354
--- /dev/null
+++ b/tests/tests/graphics/src/android/graphics/text/cts/HyphenationTest.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2021 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.graphics.text.cts;
+
+import static android.graphics.text.LineBreaker.BREAK_STRATEGY_BALANCED;
+import static android.graphics.text.LineBreaker.HYPHENATION_FREQUENCY_FULL;
+
+import static org.junit.Assert.assertEquals;
+
+import android.content.Context;
+import android.content.res.AssetManager;
+import android.graphics.Paint;
+import android.graphics.Typeface;
+import android.graphics.text.LineBreaker;
+import android.graphics.text.MeasuredText;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Locale;
+
+/**
+ * Verify the hyphenation pattern works as expected.
+ */
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class HyphenationTest {
+    private static Paint sPaint;
+
+    @BeforeClass
+    public static void classSetUp() {
+        sPaint = new Paint();
+        Context context = InstrumentationRegistry.getTargetContext();
+        AssetManager am = context.getAssets();
+        Typeface tf = new Typeface.Builder(am, "fonts/layout/linebreak.ttf").build();
+        sPaint.setTypeface(tf);
+    }
+
+    @Test
+    public void testAmharicPattern() {
+        final String locale = "am";
+        final String text = "መጋበዛቸውን መጋበዛቸውን መጋበዛቸውን መጋበዛቸውን መጋበዛቸውን";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | መጋበዛቸውን መጋበዛቸ-  |
+        // | ውን መጋበዛቸውን መ-  |
+        // | ጋበዛቸውን መጋበዛቸውን  |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(3, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(1));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(2));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(2));
+    }
+
+    @Test
+    public void testEnglishPattern() {
+        final String locale = "en";
+        final String text = "hyphenation hyphenation hyphenation hyphenation";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | hyphenation hy-   |
+        // | phenation hyphen- |
+        // | ation hyphenation |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(3, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(1));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(2));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(2));
+    }
+
+    @Test
+    public void testGalicianPattern() {
+        final String locale = "gl";
+        final String text = "tecnoloxía tecnoloxía tecnoloxía";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | tecnoloxía tecno- |
+        // | loxía tecnoloxía  |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(2, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(1));
+    }
+
+    @Test
+    public void testItalianPattern() {
+        final String locale = "it";
+        final String text = "Assicurati Assicurati Assicurati Assicurati";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | Assicurati Assi- |
+        // | curati Assicu-   |
+        // | rati Assicurati  |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(3, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(1));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(2));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(2));
+    }
+
+    @Test
+    public void testLithuanianPattern() {
+        final String locale = "lt";
+        final String text = "Pasirūpinkite Pasirūpinkite Pasirūpinkite Pasirūpinkite";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | Pasirūpinki-     |
+        // | te Pasirūpinki-  |
+        // | te Pasirūpinki-  |
+        // | te Pasirūpinkite |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(4, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(1));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(2));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(2));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(3));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(3));
+    }
+
+    @Test
+    public void testUkrainianPattern() {
+        final String locale = "uk";
+        final String text = "Увімкніть Увімкніть Увімкніть Увімкніть";
+        final float textSize = 10.0f;
+        sPaint.setTextLocale(new Locale(locale));
+        sPaint.setTextSize(textSize);
+
+        // The visual BALANCED line break output is like
+        // | Увімкніть Уві-   |
+        // | мкніть Уві-      |
+        // | мкніть Увімкніть |
+        final LineBreaker.Result r = computeLineBreaks(text);
+
+        assertEquals(3, r.getLineCount());
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(0));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(0));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(1));
+        assertEquals(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN, r.getEndLineHyphenEdit(1));
+        assertEquals(Paint.START_HYPHEN_EDIT_NO_EDIT, r.getStartLineHyphenEdit(2));
+        assertEquals(Paint.END_HYPHEN_EDIT_NO_EDIT, r.getEndLineHyphenEdit(2));
+    }
+
+    private LineBreaker.Result computeLineBreaks(String text) {
+        final LineBreaker lb = new LineBreaker.Builder()
+                .setBreakStrategy(BREAK_STRATEGY_BALANCED)
+                .setHyphenationFrequency(HYPHENATION_FREQUENCY_FULL)
+                .build();
+        final LineBreaker.ParagraphConstraints c = new LineBreaker.ParagraphConstraints();
+        c.setWidth(180f);
+        MeasuredText mt = new MeasuredText.Builder(text.toCharArray())
+                .setComputeHyphenation(MeasuredText.Builder.HYPHENATION_MODE_NORMAL)
+                .appendStyleRun(sPaint, text.length(), false)
+                .build();
+        return lb.computeLineBreaks(mt, c, 0);
+    }
+}
diff --git a/tests/tests/media/audio/src/android/media/audio/cts/AudioManagerTest.java b/tests/tests/media/audio/src/android/media/audio/cts/AudioManagerTest.java
index cdc1de0..aaedb38 100644
--- a/tests/tests/media/audio/src/android/media/audio/cts/AudioManagerTest.java
+++ b/tests/tests/media/audio/src/android/media/audio/cts/AudioManagerTest.java
@@ -61,6 +61,7 @@
 import android.media.AudioFormat;
 import android.media.AudioManager;
 import android.media.AudioProfile;
+import android.media.AudioTrack;
 import android.media.MediaPlayer;
 import android.media.MediaRecorder;
 import android.media.MicrophoneInfo;
@@ -1905,6 +1906,45 @@
         }
     }
 
+    public void testGetDirectPlaybackSupport() {
+        assertEquals(AudioManager.DIRECT_PLAYBACK_NOT_SUPPORTED,
+                AudioManager.getDirectPlaybackSupport(
+                        new AudioFormat.Builder().build(),
+                        new AudioAttributes.Builder().build()));
+        AudioDeviceInfo[] devices = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
+        AudioAttributes attr = new AudioAttributes.Builder()
+                .setUsage(AudioAttributes.USAGE_MEDIA)
+                .setLegacyStreamType(STREAM_MUSIC).build();
+        for (AudioDeviceInfo device : devices) {
+            for (int encoding : device.getEncodings()) {
+                for (int channelMask : device.getChannelMasks()) {
+                    for (int sampleRate : device.getSampleRates()) {
+                        AudioFormat format = new AudioFormat.Builder()
+                                .setEncoding(encoding)
+                                .setChannelMask(channelMask)
+                                .setSampleRate(sampleRate).build();
+                        final int directPlaybackSupport =
+                                AudioManager.getDirectPlaybackSupport(format, attr);
+                        assertEquals(
+                                AudioTrack.isDirectPlaybackSupported(format, attr),
+                                directPlaybackSupport
+                                        != AudioManager.DIRECT_PLAYBACK_NOT_SUPPORTED);
+                        if (directPlaybackSupport == AudioManager.DIRECT_PLAYBACK_NOT_SUPPORTED) {
+                            assertEquals(
+                                    AudioManager.getPlaybackOffloadSupport(format, attr),
+                                    directPlaybackSupport);
+                        } else {
+                            assertNotEquals(
+                                    AudioManager.DIRECT_PLAYBACK_NOT_SUPPORTED,
+                                    AudioManager.getPlaybackOffloadSupport(format, attr)
+                                            & directPlaybackSupport);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     private void assertStreamVolumeEquals(int stream, int expectedVolume) throws Exception {
         assertStreamVolumeEquals(stream, expectedVolume,
                 "Unexpected stream volume for stream=" + stream);
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 91d46d0..afd809c 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -1427,8 +1427,13 @@
                                     Arrays.equals(loadByteArrayFromString(INVALID_HDR_STATIC_INFO),
                                                   staticInfo.array()));
                         }
-                        assertFalse("Buffer should not have dynamic HDR metadata present",
-                                bufferFormat.containsKey(MediaFormat.KEY_HDR10_PLUS_INFO));
+                        ByteBuffer hdr10PlusInfo = bufferFormat.getByteBuffer(
+                                MediaFormat.KEY_HDR10_PLUS_INFO, null);
+                        if (hdr10PlusInfo != null) {
+                            assertEquals(
+                                    "Buffer should not have a valid dynamic HDR metadata present",
+                                    0, hdr10PlusInfo.remaining());
+                        }
 
                         if (!dynamic) {
                             codec.releaseOutputBuffer(index,  true);
diff --git a/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java b/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java
index 7dbc9cd..e2fd453 100644
--- a/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java
+++ b/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java
@@ -242,34 +242,36 @@
 
     @Test
     public void testOggBearVorbis() throws IOException {
-        testAssetExtraction("ogg/bear_vorbis.ogg");
+        testAssetExtraction("media/ogg/bear_vorbis.ogg");
     }
 
     @Test
     public void testOggBear() throws IOException {
-        testAssetExtraction("ogg/bear.opus");
+        testAssetExtraction("media/ogg/bear.opus");
     }
 
     @Test
     public void testOggBearFlac() throws IOException {
-        testAssetExtraction("ogg/bear_flac.ogg");
+        testAssetExtraction("media/ogg/bear_flac.ogg");
     }
 
     @Test
     public void testOggNoFlacSeekTable() throws IOException {
-        testAssetExtraction("ogg/bear_flac_noseektable.ogg");
+        testAssetExtraction("media/ogg/bear_flac_noseektable.ogg");
     }
 
     @Test
     public void testOggFlacHeaderSniff() throws IOException {
-        testSniffAsset("ogg/flac_header", /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
+        testSniffAsset(
+                "media/ogg/flac_header", /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
     }
 
     @Test
     public void testOggOpusHeaderSniff() throws IOException {
         try {
             testSniffAsset(
-                    "ogg/opus_header", /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
+                    "media/ogg/opus_header",
+                    /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
             fail();
         } catch (MediaParser.UnrecognizedInputFormatException e) {
             // Expected.
@@ -280,7 +282,7 @@
     public void testOggInvalidHeaderSniff() throws IOException {
         try {
             testSniffAsset(
-                    "ogg/invalid_ogg_header",
+                    "media/ogg/invalid_ogg_header",
                     /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
             fail();
         } catch (MediaParser.UnrecognizedInputFormatException e) {
@@ -288,7 +290,8 @@
         }
         try {
             testSniffAsset(
-                    "ogg/invalid_header", /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
+                    "media/ogg/invalid_header",
+                    /* expectedExtractorName= */ MediaParser.PARSER_NAME_OGG);
             fail();
         } catch (MediaParser.UnrecognizedInputFormatException e) {
             // Expected.
@@ -299,115 +302,115 @@
 
     @Test
     public void testFlacUncommonSampleRateFlac() throws IOException {
-        testAssetExtraction("flac/bear_uncommon_sample_rate.flac");
+        testAssetExtraction("media/flac/bear_uncommon_sample_rate.flac");
     }
 
     @Test
     public void testFlacNoSeekTableAndNoNumSamples() throws IOException {
-        testAssetExtraction("flac/bear_no_seek_table_no_num_samples.flac");
+        testAssetExtraction("media/flac/bear_no_seek_table_no_num_samples.flac");
     }
 
     @Test
     public void testFlacWithPicture() throws IOException {
-        testAssetExtraction("flac/bear_with_picture.flac");
+        testAssetExtraction("media/flac/bear_with_picture.flac");
     }
 
     @Test
     public void testFlacWithVorbisComments() throws IOException {
-        testAssetExtraction("flac/bear_with_vorbis_comments.flac");
+        testAssetExtraction("media/flac/bear_with_vorbis_comments.flac");
     }
 
     @Test
     public void testFlacOneMetadataBlock() throws IOException {
-        testAssetExtraction("flac/bear_one_metadata_block.flac");
+        testAssetExtraction("media/flac/bear_one_metadata_block.flac");
     }
 
     @Test
     public void testFlacNoMinMaxFrameSize() throws IOException {
-        testAssetExtraction("flac/bear_no_min_max_frame_size.flac");
+        testAssetExtraction("media/flac/bear_no_min_max_frame_size.flac");
     }
 
     @Test
     public void testFlacNoNumSamples() throws IOException {
-        testAssetExtraction("flac/bear_no_num_samples.flac");
+        testAssetExtraction("media/flac/bear_no_num_samples.flac");
     }
 
     @Test
     public void testFlacWithId3() throws IOException {
-        testAssetExtraction("flac/bear_with_id3.flac");
+        testAssetExtraction("media/flac/bear_with_id3.flac");
     }
 
     @Test
     public void testFlacSample() throws IOException {
-        testAssetExtraction("flac/bear.flac");
+        testAssetExtraction("media/flac/bear.flac");
     }
 
     // MP3.
 
     @Test
     public void testMp3WithNoSeekTableVariableFrameSize() throws IOException {
-        testAssetExtraction("mp3/bear-cbr-variable-frame-size-no-seek-table.mp3");
+        testAssetExtraction("media/mp3/bear-cbr-variable-frame-size-no-seek-table.mp3");
     }
 
     @Test
     public void testMp3WithVariableBitrateAndXingHeader() throws IOException {
-        testAssetExtraction("mp3/bear-vbr-xing-header.mp3");
+        testAssetExtraction("media/mp3/bear-vbr-xing-header.mp3");
     }
 
     @Test
     public void testMp3WithNoSeekTableVariableBitrate() throws IOException {
-        testAssetExtraction("mp3/bear-vbr-no-seek-table.mp3");
+        testAssetExtraction("media/mp3/bear-vbr-no-seek-table.mp3");
     }
 
     @Test
     public void testMp3WithTrimmedSample() throws IOException {
-        testAssetExtraction("mp3/play-trimmed.mp3");
+        testAssetExtraction("media/mp3/play-trimmed.mp3");
     }
 
     @Test
     public void testMp3WithId3() throws IOException {
-        testAssetExtraction("mp3/bear-id3.mp3");
+        testAssetExtraction("media/mp3/bear-id3.mp3");
     }
 
     // WAV.
 
     @Test
     public void testWavWithImaAdpcm() throws IOException {
-        testAssetExtraction("wav/sample_ima_adpcm.wav");
+        testAssetExtraction("media/wav/sample_ima_adpcm.wav");
     }
 
     @Test
     public void testWav() throws IOException {
-        testAssetExtraction("wav/sample.wav");
+        testAssetExtraction("media/wav/sample.wav");
     }
 
     // AMR.
 
     @Test
     public void testAmrNarrowBandSamplesWithConstantBitrateSeeking() throws IOException {
-        testAssetExtraction("amr/sample_nb_cbr.amr");
+        testAssetExtraction("media/amr/sample_nb_cbr.amr");
     }
 
     @Test
     public void testAmrNarrowBandSamples() throws IOException {
-        testAssetExtraction("amr/sample_nb.amr");
+        testAssetExtraction("media/amr/sample_nb.amr");
     }
 
     @Test
     public void testAmrWideBandSamples() throws IOException {
-        testAssetExtraction("amr/sample_wb.amr");
+        testAssetExtraction("media/amr/sample_wb.amr");
     }
 
     @Test
     public void testAmrWideBandSamplesWithConstantBitrateSeeking() throws IOException {
-        testAssetExtraction("amr/sample_wb_cbr.amr");
+        testAssetExtraction("media/amr/sample_wb_cbr.amr");
     }
 
     // FLV.
 
     @Test
     public void testFlv() throws IOException {
-        testAssetExtraction("flv/sample.flv");
+        testAssetExtraction("media/flv/sample.flv");
     }
 
     // PS.
@@ -416,17 +419,17 @@
     @Test
     @Ignore
     public void testPsElphantsDream() throws IOException {
-        testAssetExtraction("ts/elephants_dream.mpg");
+        testAssetExtraction("media/ts/elephants_dream.mpg");
     }
 
     @Test
     public void testPsWithAc3() throws IOException {
-        testAssetExtraction("ts/sample_ac3.ps");
+        testAssetExtraction("media/ts/sample_ac3.ps");
     }
 
     @Test
     public void testPsWithH262MpegAudio() throws IOException {
-        testAssetExtraction("ts/sample_h262_mpeg_audio.ps");
+        testAssetExtraction("media/ts/sample_h262_mpeg_audio.ps");
     }
 
     // ADTS.
@@ -434,41 +437,34 @@
     @Test
     public void testAdtsTruncatedWithConstantBitrateSeeking() throws IOException {
         testAssetExtraction(
-                "ts/sample_cbs_truncated.adts",
+                "media/ts/sample_cbs_truncated.adts",
                 Collections.singletonMap(MediaParser.PARAMETER_ADTS_ENABLE_CBR_SEEKING, true));
     }
 
     @Test
     public void testAdts() throws IOException {
-        testAssetExtraction("ts/sample.adts");
-    }
-
-    @Test
-    public void testAdtsWithConstantBitrateSeeking() throws IOException {
-        testAssetExtraction(
-                "ts/sample_cbs.adts",
-                Collections.singletonMap(MediaParser.PARAMETER_ADTS_ENABLE_CBR_SEEKING, true));
+        testAssetExtraction("media/ts/sample.adts");
     }
 
     // AC-3.
 
     @Test
     public void testAc3() throws IOException {
-        testAssetExtraction("ts/sample.ac3");
+        testAssetExtraction("media/ts/sample.ac3");
     }
 
     // AC-4.
 
     @Test
     public void testAc4() throws IOException {
-        testAssetExtraction("ts/sample.ac4");
+        testAssetExtraction("media/ts/sample.ac4");
     }
 
     // EAC-3.
 
     @Test
     public void testEac3() throws IOException {
-        testAssetExtraction("ts/sample.eac3");
+        testAssetExtraction("media/ts/sample.eac3");
     }
 
     // TS.
@@ -477,7 +473,7 @@
     public void testTsBigBuckBunny() throws IOException {
         // This file is too big to run a full extraction with multiple seeks like other tests do.
         MockMediaParserOutputConsumer outputConsumer = new MockMediaParserOutputConsumer();
-        MockMediaParserInputReader inputReader = getInputReader("ts/bbb_2500ms.ts");
+        MockMediaParserInputReader inputReader = getInputReader("media/ts/bbb_2500ms.ts");
         MediaParser mediaParser = MediaParser.create(outputConsumer);
         advanceUntilSample(outputConsumer, inputReader, mediaParser, /* sampleNumber= */ 100);
         assertThat(outputConsumer.getSeekMap().getDurationMicros()).isEqualTo(2_500_000);
@@ -488,71 +484,71 @@
 
     @Test
     public void testTsWithH262MpegAudio() throws IOException {
-        testAssetExtraction("ts/sample_h262_mpeg_audio.ts");
+        testAssetExtraction("media/ts/sample_h262_mpeg_audio.ts");
     }
 
     @Test
     public void testTsWithH264MpegAudio() throws IOException {
-        testAssetExtraction("ts/sample_h264_mpeg_audio.ts");
+        testAssetExtraction("media/ts/sample_h264_mpeg_audio.ts");
     }
 
     @Test
     public void testTsWithH264DetectAccessUnits() throws IOException {
         testAssetExtraction(
-                "ts/sample_h264_no_access_unit_delimiters.ts",
+                "media/ts/sample_h264_no_access_unit_delimiters.ts",
                 Collections.singletonMap(MediaParser.PARAMETER_TS_DETECT_ACCESS_UNITS, true));
     }
 
     @Test
     public void testTsWithH264DtsAudio() throws IOException {
         testAssetExtraction(
-                "ts/sample_h264_dts_audio.ts",
+                "media/ts/sample_h264_dts_audio.ts",
                 Collections.singletonMap(
                         MediaParser.PARAMETER_TS_ENABLE_HDMV_DTS_AUDIO_STREAMS, true));
     }
 
     @Test
     public void testTsWithLatm() throws IOException {
-        testAssetExtraction("ts/sample_latm.ts");
+        testAssetExtraction("media/ts/sample_latm.ts");
     }
 
     @Test
     public void testTsWithSdt() throws IOException {
-        testAssetExtraction("ts/sample_with_sdt.ts");
+        testAssetExtraction("media/ts/sample_with_sdt.ts");
     }
 
     @Test
     public void testTsWithH265() throws IOException {
-        testAssetExtraction("ts/sample_h265.ts");
+        testAssetExtraction("media/ts/sample_h265.ts");
     }
 
     // MKV.
 
     @Test
     public void testMatroskaSubsampleEncryptedNoAltref() throws IOException {
-        testAssetExtraction("mkv/subsample_encrypted_noaltref.webm");
+        testAssetExtraction("media/mkv/subsample_encrypted_noaltref.webm");
     }
 
     @Test
     public void testMatroskaFile() throws IOException {
-        testAssetExtraction("mkv/sample.mkv");
+        testAssetExtraction("media/mkv/sample.mkv");
     }
 
     @Test
     public void testMatroskaFullBlocks() throws IOException {
-        testAssetExtraction("mkv/full_blocks.mkv");
+        testAssetExtraction("media/mkv/full_blocks.mkv");
     }
 
     @Test
     public void testMatroskaSubsampleEncryptedAltref() throws IOException {
-        testAssetExtraction("mkv/subsample_encrypted_altref.webm");
+        testAssetExtraction("media/mkv/subsample_encrypted_altref.webm");
     }
 
     @Test
     public void testMatroskaOutOfBandCrypto() throws IOException {
         MockMediaParserOutputConsumer outputConsumer = new MockMediaParserOutputConsumer();
         MockMediaParserInputReader inputReader =
-                getInputReader("mkv/subsample_encrypted_noaltref.webm");
+                getInputReader("media/mkv/subsample_encrypted_noaltref.webm");
         MediaParser mediaParser = MediaParser.create(outputConsumer);
         // Initialization vectors are 16 bytes in size, as per CryptoInfo documentation.
         MediaCodec.CryptoInfo expectedCryptoInfo = new MediaCodec.CryptoInfo();
@@ -573,53 +569,54 @@
 
     @Test
     public void testMp4Ac4Fragmented() throws IOException {
-        testAssetExtraction("mp4/sample_ac4_fragmented.mp4");
+        testAssetExtraction("media/mp4/sample_ac4_fragmented.mp4");
     }
 
     @Test
     public void testMp4AndroidSlowMotion() throws IOException {
-        testAssetExtraction("mp4/sample_android_slow_motion.mp4");
+        testAssetExtraction("media/mp4/sample_android_slow_motion.mp4");
     }
 
     @Test
     public void testMp4FragmentedSei() throws IOException {
-        testAssetExtraction("mp4/sample_fragmented_sei.mp4");
+        testAssetExtraction("media/mp4/sample_fragmented_sei.mp4");
     }
 
     @Test
     public void testMp4WithAc4() throws IOException {
-        testAssetExtraction("mp4/sample_ac4.mp4");
+        testAssetExtraction("media/mp4/sample_ac4.mp4");
     }
 
     @Test
     public void testMp4FragmentedSeekable() throws IOException {
-        testAssetExtraction("mp4/sample_fragmented_seekable.mp4");
+        testAssetExtraction("media/mp4/sample_fragmented_seekable.mp4");
     }
 
     @Test
     public void testMp4WithProtectedAc4() throws IOException {
-        testAssetExtraction("mp4/sample_ac4_protected.mp4");
+        testAssetExtraction("media/mp4/sample_ac4_protected.mp4");
     }
 
     @Test
     public void testMp4() throws IOException {
-        testAssetExtraction("mp4/sample.mp4");
+        testAssetExtraction("media/mp4/sample.mp4");
     }
 
     @Test
     public void testMp4MdatTooLong() throws IOException {
-        testAssetExtraction("mp4/sample_mdat_too_long.mp4");
+        testAssetExtraction("media/mp4/sample_mdat_too_long.mp4");
     }
 
     @Test
     public void testMp4Fragmented() throws IOException {
-        testAssetExtraction("mp4/sample_fragmented.mp4");
+        testAssetExtraction("media/mp4/sample_fragmented.mp4");
     }
 
     @Test
     public void testMp4FragmentedOutOfBandCrypto() throws IOException {
         MockMediaParserOutputConsumer outputConsumer = new MockMediaParserOutputConsumer();
-        MockMediaParserInputReader inputReader = getInputReader("mp4/sample_ac4_protected.mp4");
+        MockMediaParserInputReader inputReader =
+                getInputReader("media/mp4/sample_ac4_protected.mp4");
         MediaParser mediaParser = MediaParser.create(outputConsumer);
         // Initialization vectors are 16 bytes in size, as per CryptoInfo documentation.
         MediaCodec.CryptoInfo expectedCryptoInfo = new MediaCodec.CryptoInfo();
diff --git a/tests/tests/mediaparser/src/android/media/mediaparser/cts/MockMediaParserOutputConsumer.java b/tests/tests/mediaparser/src/android/media/mediaparser/cts/MockMediaParserOutputConsumer.java
index 2f5b8f9..aea6c19 100644
--- a/tests/tests/mediaparser/src/android/media/mediaparser/cts/MockMediaParserOutputConsumer.java
+++ b/tests/tests/mediaparser/src/android/media/mediaparser/cts/MockMediaParserOutputConsumer.java
@@ -30,6 +30,7 @@
 import com.google.android.exoplayer2.extractor.SeekPoint;
 import com.google.android.exoplayer2.extractor.TrackOutput;
 import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
+import com.google.android.exoplayer2.testutil.FakeTrackOutput;
 import com.google.android.exoplayer2.upstream.DataReader;
 import com.google.android.exoplayer2.video.ColorInfo;
 
@@ -52,7 +53,10 @@
 
     public MockMediaParserOutputConsumer(boolean usingInBandCryptoInfo) {
         mUsingInBandCryptoInfo = usingInBandCryptoInfo;
-        mFakeExtractorOutput = new FakeExtractorOutput();
+        mFakeExtractorOutput =
+                new FakeExtractorOutput(
+                        /* trackOutputFactory= */ (id, type) ->
+                                new FakeTrackOutput(/* deduplicateConsecutiveFormats= */ true));
         mTrackOutputs = new ArrayList<>();
     }
 
diff --git a/tests/tests/os/Android.bp b/tests/tests/os/Android.bp
index 43dfba1..14815f2 100644
--- a/tests/tests/os/Android.bp
+++ b/tests/tests/os/Android.bp
@@ -61,7 +61,7 @@
     test_suites: [
         "cts",
         "general-tests",
-        "mts",
+        "mts-permission",
         "sts",
     ],
     sdk_version: "test_current",
diff --git a/tests/tests/os/AutoRevokeQApp/Android.bp b/tests/tests/os/AutoRevokeQApp/Android.bp
index 72e9f08..5c7d4b9 100644
--- a/tests/tests/os/AutoRevokeQApp/Android.bp
+++ b/tests/tests/os/AutoRevokeQApp/Android.bp
@@ -29,7 +29,7 @@
         "cts",
         "vts",
         "vts10",
-        "mts",
+        "mts-permission",
         "general-tests",
         "sts",
     ],
diff --git a/tests/tests/os/AutoRevokeRApp/Android.bp b/tests/tests/os/AutoRevokeRApp/Android.bp
index cb82a12..8e01388 100644
--- a/tests/tests/os/AutoRevokeRApp/Android.bp
+++ b/tests/tests/os/AutoRevokeRApp/Android.bp
@@ -28,7 +28,7 @@
     test_suites: [
         "cts",
         "vts",
-        "mts",
+        "mts-permission",
         "general-tests",
         "sts",
     ],
diff --git a/tests/tests/os/AutoRevokeSApp/Android.bp b/tests/tests/os/AutoRevokeSApp/Android.bp
index 77fba78..60ca80f 100644
--- a/tests/tests/os/AutoRevokeSApp/Android.bp
+++ b/tests/tests/os/AutoRevokeSApp/Android.bp
@@ -28,7 +28,7 @@
     test_suites: [
         "cts",
         "vts",
-        "mts",
+        "mts-permission",
         "general-tests",
         "sts",
     ],
diff --git a/tests/tests/os/CompanionTestApp/Android.bp b/tests/tests/os/CompanionTestApp/Android.bp
index b8d873e..3a0f07e 100644
--- a/tests/tests/os/CompanionTestApp/Android.bp
+++ b/tests/tests/os/CompanionTestApp/Android.bp
@@ -30,7 +30,7 @@
         "cts",
         "vts",
         "vts10",
-        "mts",
+        "mts-permission",
         "general-tests",
         "sts",
     ],
diff --git a/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt b/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
index 819710e..c10120e 100644
--- a/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
+++ b/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
@@ -33,7 +33,6 @@
 import android.util.SizeF
 import android.util.SparseArray
 import android.widget.ListView
-import android.widget.TextView
 import androidx.test.InstrumentationRegistry
 import androidx.test.runner.AndroidJUnit4
 import androidx.test.uiautomator.By
@@ -49,7 +48,6 @@
 import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
 import com.android.compatibility.common.util.ThrowingSupplier
 import com.android.compatibility.common.util.UiAutomatorUtils.waitFindObject
-import com.android.compatibility.common.util.children
 import com.android.compatibility.common.util.click
 import java.io.Serializable
 import org.hamcrest.CoreMatchers.containsString
@@ -79,6 +77,11 @@
         const val TEST_APP_PACKAGE_NAME = "android.os.cts.companiontestapp"
         const val TEST_APP_APK_LOCATION = "/data/local/tmp/cts/os/CtsCompanionTestApp.apk"
         const val CDM_UI_PACKAGE_NAME = "com.android.companiondevicemanager"
+
+        val DEVICE_LIST_ITEM_SELECTOR: BySelector = By.res(CDM_UI_PACKAGE_NAME, "list_item_device")
+        val DEVICE_LIST_SELECTOR: BySelector = By.pkg(CDM_UI_PACKAGE_NAME)
+                .clazz(ListView::class.java.name)
+                .hasChild(DEVICE_LIST_ITEM_SELECTOR)
     }
 
     private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
@@ -176,11 +179,8 @@
         click("Watch")
         click("Associate")
 
-        val deviceListSelector = By.pkg(CDM_UI_PACKAGE_NAME)
-                .clazz(ListView::class.java.name)
-                .hasChild(By.clazz(TextView::class.java.name))
-        uiDevice.wait(Until.findObject(deviceListSelector), 20_000)
-                ?.findObject(By.clazz(TextView::class.java.name))
+        uiDevice.wait(Until.findObject(DEVICE_LIST_SELECTOR), 20_000)
+                ?.findObject(DEVICE_LIST_ITEM_SELECTOR)
                 ?.click()
                 ?: throw AssertionError("Empty device list")
 
@@ -211,17 +211,12 @@
         uiDevice.waitAndFind(By.desc("name filter")).text = ""
         uiDevice.waitForIdle()
 
-        val deviceForAssociation = getEventually({
-            click("Associate")
-            waitFindNode(hasIdThat(containsString("device_list")),
-                    failMsg = "Test requires a discoverable bluetooth device nearby",
-                    timeoutMs = 5_000)
-                    .children
-                    .find { it.className == TextView::class.java.name }
-                    .assertNotNull { "Empty device list" }
-        }, 60_000)
+        click("Associate")
 
-        deviceForAssociation!!.click()
+        uiDevice.wait(Until.findObject(DEVICE_LIST_SELECTOR), 20_000)
+                ?.findObject(DEVICE_LIST_ITEM_SELECTOR)
+                ?.click()
+                ?: throw AssertionError("Empty device list")
 
         waitForIdle()
 
diff --git a/tests/tests/packageinstaller/nopermission/AndroidTest.xml b/tests/tests/packageinstaller/nopermission/AndroidTest.xml
index 08ae8cc..49fcf89 100644
--- a/tests/tests/packageinstaller/nopermission/AndroidTest.xml
+++ b/tests/tests/packageinstaller/nopermission/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <option name="run-command" value="mkdir -p /data/local/tmp/cts/nopermission" />
diff --git a/tests/tests/packageinstaller/nopermission25/AndroidTest.xml b/tests/tests/packageinstaller/nopermission25/AndroidTest.xml
index 3c69674..c84a81f 100644
--- a/tests/tests/packageinstaller/nopermission25/AndroidTest.xml
+++ b/tests/tests/packageinstaller/nopermission25/AndroidTest.xml
@@ -21,6 +21,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <option name="run-command" value="mkdir -p /data/local/tmp/cts/nopermission" />
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 5a76361..d2a8846 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -1478,10 +1478,28 @@
          measure what is happening inside their body, such as heart rate.
          <p>Protection level: dangerous -->
     <permission android:name="android.permission.BODY_SENSORS"
-        android:permissionGroup="android.permission-group.UNDEFINED"
-        android:label="@string/permlab_bodySensors"
-        android:description="@string/permdesc_bodySensors"
-        android:protectionLevel="dangerous" />
+                android:permissionGroup="android.permission-group.UNDEFINED"
+                android:label="@string/permlab_bodySensors"
+                android:description="@string/permdesc_bodySensors"
+                android:backgroundPermission="android.permission.BODY_SENSORS_BACKGROUND"
+                android:protectionLevel="dangerous" />
+
+    <!-- Allows an application to access data from sensors that the user uses to measure what is
+         happening inside their body, such as heart rate. If you're requesting this permission, you
+         must also request {@link #BODY_SENSORS}. Requesting this permission by itself doesn't give
+         you Body sensors access.
+         <p>Protection level: dangerous
+
+         <p> This is a hard restricted permission which cannot be held by an app until
+         the installer on record whitelists the permission. For more details see
+         {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
+    -->
+    <permission android:name="android.permission.BODY_SENSORS_BACKGROUND"
+                android:permissionGroup="android.permission-group.UNDEFINED"
+                android:label="@string/permlab_bodySensors_background"
+                android:description="@string/permdesc_bodySensors_background"
+                android:protectionLevel="dangerous"
+                android:permissionFlags="hardRestricted" />
 
     <!-- Allows an app to use fingerprint hardware.
          <p>Protection level: normal
@@ -6070,6 +6088,13 @@
     <permission android:name="android.permission.UPDATE_DEVICE_MANAGEMENT_RESOURCES"
                 android:protectionLevel="signature|role" />
     
+    <!-- @SystemApi Allows an app to read whether SafetyCenter is enabled/disabled.
+             <p>Protection level: signature|privileged
+             @hide
+        -->
+    <permission android:name="android.permission.READ_SAFETY_CENTER_STATUS"
+        android:protectionLevel="signature|privileged" />
+
     <!-- Attribution for Geofencing service. -->
     <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
     <!-- Attribution for Country Detector. -->
diff --git a/tests/tests/permission3/Android.bp b/tests/tests/permission3/Android.bp
index e348e3d..2380fe1 100644
--- a/tests/tests/permission3/Android.bp
+++ b/tests/tests/permission3/Android.bp
@@ -48,6 +48,7 @@
         ":CtsUsePermissionApp30WithBackground",
         ":CtsUsePermissionApp30WithBluetooth",
         ":CtsUsePermissionApp31",
+        ":CtsUsePermissionApp32",
         ":CtsUsePermissionAppLatest",
         ":CtsUsePermissionAppLatestNone",
         ":CtsUsePermissionAppWithOverlay",
diff --git a/tests/tests/permission3/AndroidTest.xml b/tests/tests/permission3/AndroidTest.xml
index a360871..cd6323e 100644
--- a/tests/tests/permission3/AndroidTest.xml
+++ b/tests/tests/permission3/AndroidTest.xml
@@ -55,6 +55,7 @@
         <option name="push" value="CtsUsePermissionApp30WithBackground.apk->/data/local/tmp/cts/permission3/CtsUsePermissionApp30WithBackground.apk" />
         <option name="push" value="CtsUsePermissionApp30WithBluetooth.apk->/data/local/tmp/cts/permission3/CtsUsePermissionApp30WithBluetooth.apk" />
         <option name="push" value="CtsUsePermissionApp31.apk->/data/local/tmp/cts/permission3/CtsUsePermissionApp31.apk" />
+        <option name="push" value="CtsUsePermissionApp32.apk->/data/local/tmp/cts/permission3/CtsUsePermissionApp32.apk" />
         <option name="push" value="CtsUsePermissionAppLatest.apk->/data/local/tmp/cts/permission3/CtsUsePermissionAppLatest.apk" />
         <option name="push" value="CtsUsePermissionAppLatestNone.apk->/data/local/tmp/cts/permission3/CtsUsePermissionAppLatestNone.apk" />
         <option name="push" value="CtsUsePermissionAppWithOverlay.apk->/data/local/tmp/cts/permission3/CtsUsePermissionAppWithOverlay.apk" />
diff --git a/tests/tests/permission3/UsePermissionApp31/AndroidManifest.xml b/tests/tests/permission3/UsePermissionApp31/AndroidManifest.xml
index f6d9b29..dfa12b7 100644
--- a/tests/tests/permission3/UsePermissionApp31/AndroidManifest.xml
+++ b/tests/tests/permission3/UsePermissionApp31/AndroidManifest.xml
@@ -20,6 +20,7 @@
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.BODY_SENSORS" />
     <application>
         <activity android:name=".CheckCalendarAccessActivity" android:exported="true" />
         <activity android:name=".FinishOnCreateActivity" android:exported="true" />
diff --git a/tests/tests/permission3/UsePermissionApp32/Android.bp b/tests/tests/permission3/UsePermissionApp32/Android.bp
new file mode 100644
index 0000000..0f985b6
--- /dev/null
+++ b/tests/tests/permission3/UsePermissionApp32/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2021 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 {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test_helper_app {
+    name: "CtsUsePermissionApp32",
+    srcs: [
+        ":CtsUsePermissionAppSrc",
+    ],
+    static_libs: [
+        "kotlin-stdlib",
+    ],
+    certificate: ":cts-testkey2",
+
+    min_sdk_version: "32",
+}
diff --git a/tests/tests/permission3/UsePermissionApp32/AndroidManifest.xml b/tests/tests/permission3/UsePermissionApp32/AndroidManifest.xml
new file mode 100644
index 0000000..825cf51
--- /dev/null
+++ b/tests/tests/permission3/UsePermissionApp32/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2021 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.
+  -->
+<manifest
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.permission3.cts.usepermission">
+    <uses-sdk android:minSdkVersion="32" android:targetSdkVersion="32" />
+    <uses-permission android:name="android.permission.BODY_SENSORS" />
+    <application>
+        <activity android:name=".RequestPermissionsActivity" android:exported="true" />
+    </application>
+</manifest>
diff --git a/tests/tests/permission3/UsePermissionAppLatest/AndroidManifest.xml b/tests/tests/permission3/UsePermissionAppLatest/AndroidManifest.xml
index 1d8cdf3..0c125d0 100644
--- a/tests/tests/permission3/UsePermissionAppLatest/AndroidManifest.xml
+++ b/tests/tests/permission3/UsePermissionAppLatest/AndroidManifest.xml
@@ -25,7 +25,7 @@
     <uses-permission android:name="android.permission.RECEIVE_SMS" />
 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
+    <uses-permission android:name="android.permission.BODY_SENSORS" />
     <application>
         <activity android:name=".CheckCalendarAccessActivity" android:exported="true" />
         <activity android:name=".FinishOnCreateActivity" android:exported="true" />
diff --git a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
index 59202e2..ee1b840 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
@@ -53,6 +53,7 @@
         const val APP_APK_PATH_29 = "$APK_DIRECTORY/CtsUsePermissionApp29.apk"
         const val APP_APK_PATH_30 = "$APK_DIRECTORY/CtsUsePermissionApp30.apk"
         const val APP_APK_PATH_31 = "$APK_DIRECTORY/CtsUsePermissionApp31.apk"
+        const val APP_APK_PATH_32 = "$APK_DIRECTORY/CtsUsePermissionApp32.apk"
 
         const val APP_APK_PATH_30_WITH_BACKGROUND =
                 "$APK_DIRECTORY/CtsUsePermissionApp30WithBackground.apk"
@@ -153,6 +154,8 @@
             android.Manifest.permission.CAMERA to "@android:string/permgrouplab_camera",
             // Body sensors
             android.Manifest.permission.BODY_SENSORS to "@android:string/permgrouplab_sensors",
+            android.Manifest.permission.BODY_SENSORS_BACKGROUND
+                    to "@android:string/permgrouplab_sensors",
             // Bluetooth
             android.Manifest.permission.BLUETOOTH_CONNECT to
                     "@android:string/permgrouplab_nearby_devices",
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionSplitTest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionSplitTest.kt
index 22074f7..7b56321 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionSplitTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionSplitTest.kt
@@ -53,6 +53,24 @@
         testLocationPermissionSplit(false)
     }
 
+    @Test
+    fun testBodySensorSplit() {
+        installPackage(APP_APK_PATH_31)
+        testBodySensorPermissionSplit(true)
+    }
+
+    @Test
+    fun testBodySensorSplit32() {
+        installPackage(APP_APK_PATH_32)
+        testBodySensorPermissionSplit(true)
+    }
+
+    @Test
+    fun testBodySensorNonSplit() {
+        installPackage(APP_APK_PATH_LATEST)
+        testBodySensorPermissionSplit(false)
+    }
+
     private fun testLocationPermissionSplit(expectSplit: Boolean) {
         assertAppHasPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, false)
         assertAppHasPermission(android.Manifest.permission.ACCESS_BACKGROUND_LOCATION, false)
@@ -69,4 +87,21 @@
 
         assertAppHasPermission(android.Manifest.permission.ACCESS_BACKGROUND_LOCATION, expectSplit)
     }
+
+    private fun testBodySensorPermissionSplit(expectSplit: Boolean) {
+        assertAppHasPermission(android.Manifest.permission.BODY_SENSORS, false)
+        assertAppHasPermission(android.Manifest.permission.BODY_SENSORS_BACKGROUND, false)
+
+        requestAppPermissionsAndAssertResult(
+                android.Manifest.permission.BODY_SENSORS to true
+        ) {
+            if (expectSplit) {
+                clickPermissionRequestSettingsLinkAndAllowAlways()
+            } else {
+                clickPermissionRequestAllowForegroundButton()
+            }
+        }
+
+        assertAppHasPermission(android.Manifest.permission.BODY_SENSORS_BACKGROUND, expectSplit)
+    }
 }
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
index 0a2c373..f9c4496 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
@@ -246,11 +246,10 @@
             android.Manifest.permission.READ_SMS,
             android.Manifest.permission.CALL_PHONE,
             android.Manifest.permission.RECORD_AUDIO,
-            android.Manifest.permission.BODY_SENSORS,
             android.Manifest.permission.CAMERA,
             android.Manifest.permission.READ_EXTERNAL_STORAGE, targetSdk = 23
         )
-        // Don't use UI for granting location permission as this shows another dialog
+        // Don't use UI for granting location and sensor permissions as they show another dialog
         uiAutomation.grantRuntimePermission(
             APP_PACKAGE_NAME, android.Manifest.permission.ACCESS_FINE_LOCATION
         )
@@ -260,6 +259,9 @@
         uiAutomation.grantRuntimePermission(
             APP_PACKAGE_NAME, android.Manifest.permission.ACCESS_BACKGROUND_LOCATION
         )
+        uiAutomation.grantRuntimePermission(
+            APP_PACKAGE_NAME, android.Manifest.permission.BODY_SENSORS
+        )
 
         uninstallPackage(APP_PACKAGE_NAME)
         installPackage(APP_APK_PATH_23)
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTestLatest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTestLatest.kt
new file mode 100644
index 0000000..77cb3bb
--- /dev/null
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTestLatest.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 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.permission3.cts
+
+import android.os.Build
+import org.junit.Assert
+import org.junit.Test
+
+class PermissionTestLatest : BaseUsePermissionTest() {
+    /**
+     * Not exactly a cts type test but it needs to be run continuously. This test is supposed to
+     * start failing once the sdk integer is decided for T. This is important to have because it was
+     * assumed that the sdk int will be 33 in frameworks/base/data/etc/platform.xml. This test
+     * should be removed once the sdk is finalized.
+     */
+    @Test
+    fun testTApiVersionCodeIsNotSet() {
+        Assert.assertEquals(Build.VERSION_CODES.S_V2, Build.VERSION.SDK_INT)
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
index e1ae767..71ffe0d 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
@@ -50,7 +50,7 @@
     private static final int TIMEOUT = 8000;
 
     private static final String RESOURCE_DONE = "done";
-    private static final String RESOURCE_INTERNET_DIALOG_DONE = "done_layout";
+    private static final String RESOURCE_INTERNET_DIALOG_DONE = "done_button";
     private static final String RESOURCE_SEE_MORE = "see_more";
     private static final String RESOURCE_TITLE = "panel_title";
     private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
@@ -137,6 +137,7 @@
 
     @Test
     public void internetDialog_doneClosesDialog() {
+        assumeTrue(mHasTouchScreen);
         // Launch panel
         launchInternetDialog();
         String currentPackage = mDevice.getCurrentPackageName();
diff --git a/tests/tests/role/Android.bp b/tests/tests/role/Android.bp
index a638561..ae1fdfd 100644
--- a/tests/tests/role/Android.bp
+++ b/tests/tests/role/Android.bp
@@ -43,5 +43,6 @@
     data: [
         ":CtsRoleTestApp",
         ":CtsRoleTestApp28",
+        ":CtsRoleTestApp33WithoutInCallService",
     ],
 }
diff --git a/tests/tests/role/AndroidTest.xml b/tests/tests/role/AndroidTest.xml
index 4a8189f..bde2697 100644
--- a/tests/tests/role/AndroidTest.xml
+++ b/tests/tests/role/AndroidTest.xml
@@ -38,6 +38,7 @@
         <option name="cleanup" value="true" />
         <option name="push" value="CtsRoleTestApp.apk->/data/local/tmp/cts/role/CtsRoleTestApp.apk" />
         <option name="push" value="CtsRoleTestApp28.apk->/data/local/tmp/cts/role/CtsRoleTestApp28.apk" />
+        <option name="push" value="CtsRoleTestApp33WithoutInCallService.apk->/data/local/tmp/cts/role/CtsRoleTestApp33WithoutInCallService.apk" />
     </target_preparer>
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
diff --git a/tests/tests/role/CtsRoleTestApp/AndroidManifest.xml b/tests/tests/role/CtsRoleTestApp/AndroidManifest.xml
index eb17122..b2dfca9 100644
--- a/tests/tests/role/CtsRoleTestApp/AndroidManifest.xml
+++ b/tests/tests/role/CtsRoleTestApp/AndroidManifest.xml
@@ -54,7 +54,20 @@
                 <data android:scheme="tel" />
             </intent-filter>
         </activity>
-
+        <service
+            android:name=".DialerInCallService"
+            android:permission="android.permission.BIND_INCALL_SERVICE"
+            android:exported="true">
+            <meta-data
+                android:name="android.telecom.IN_CALL_SERVICE_UI"
+                android:value="true"/>
+            <meta-data
+                android:name="android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
+                android:value="false"/>
+            <intent-filter>
+                <action android:name="android.telecom.InCallService" />
+            </intent-filter>
+        </service>
         <!-- Sms -->
         <activity
             android:name=".SmsSendToActivity"
diff --git a/tests/tests/role/CtsRoleTestApp33WithoutInCallService/Android.bp b/tests/tests/role/CtsRoleTestApp33WithoutInCallService/Android.bp
new file mode 100644
index 0000000..7cce565
--- /dev/null
+++ b/tests/tests/role/CtsRoleTestApp33WithoutInCallService/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 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 {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test_helper_app {
+    name: "CtsRoleTestApp33WithoutInCallService",
+    min_sdk_version: "30",
+    target_sdk_version: "33",
+}
diff --git a/tests/tests/role/CtsRoleTestApp33WithoutInCallService/AndroidManifest.xml b/tests/tests/role/CtsRoleTestApp33WithoutInCallService/AndroidManifest.xml
new file mode 100644
index 0000000..a6504ad
--- /dev/null
+++ b/tests/tests/role/CtsRoleTestApp33WithoutInCallService/AndroidManifest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  ~ Copyright (C) 2021 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.
+  -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.app.role.cts.app33WithoutInCallService">
+    <application android:label="CtsRoleTestApp33WithoutInCallService">
+        <!-- Dialer -->
+        <activity
+            android:name=".DialerDialActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.DIAL" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.DIAL" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="tel" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
index 766a927..4cc198c 100644
--- a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
+++ b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
@@ -111,6 +111,11 @@
     private static final String APP_28_CHANGE_DEFAULT_SMS_ACTIVITY_NAME = APP_28_PACKAGE_NAME
             + ".ChangeDefaultSmsActivity";
 
+    private static final String APP_33_WITHOUT_INCALLSERVICE_APK_PATH =
+            "/data/local/tmp/cts/role/CtsRoleTestApp33WithoutInCallService.apk";
+    private static final String APP_33_WITHOUT_INCALLSERVICE_PACKAGE_NAME =
+            "android.app.role.cts.app33WithoutInCallService";
+
     private static final String PERMISSION_MANAGE_ROLES_FROM_CONTROLLER =
             "com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER";
 
@@ -158,12 +163,14 @@
     public void installApp() throws Exception {
         installPackage(APP_APK_PATH);
         installPackage(APP_28_APK_PATH);
+        installPackage(APP_33_WITHOUT_INCALLSERVICE_APK_PATH);
     }
 
     @After
     public void uninstallApp() throws Exception {
         uninstallPackage(APP_PACKAGE_NAME);
         uninstallPackage(APP_28_PACKAGE_NAME);
+        uninstallPackage(APP_33_WITHOUT_INCALLSERVICE_PACKAGE_NAME);
     }
 
     @Before
@@ -537,6 +544,28 @@
     }
 
     @Test
+    @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU, codeName = "Tiramisu")
+    public void testHoldDialerRoleRequirementWithInCallServiceAndSdk()
+            throws Exception {
+        assumeTrue(sRoleManager.isRoleAvailable(RoleManager.ROLE_DIALER));
+        // target below sdk 33 without InCallService component can hold dialer role
+        addRoleHolder(
+                RoleManager.ROLE_DIALER, APP_28_PACKAGE_NAME, true);
+        assertIsRoleHolder(
+                RoleManager.ROLE_DIALER, APP_28_PACKAGE_NAME, true);
+        // target sdk 33 without InCallService component cannot hold dialer role
+        addRoleHolder(
+                RoleManager.ROLE_DIALER, APP_33_WITHOUT_INCALLSERVICE_PACKAGE_NAME, false);
+        assertIsRoleHolder(
+                RoleManager.ROLE_DIALER, APP_33_WITHOUT_INCALLSERVICE_PACKAGE_NAME, false);
+        // target sdk 33 with InCallService component can hold dialer role
+        addRoleHolder(
+                RoleManager.ROLE_DIALER, APP_PACKAGE_NAME, true);
+        assertIsRoleHolder(
+                RoleManager.ROLE_DIALER, APP_PACKAGE_NAME, true);
+    }
+
+    @Test
     public void
     targetSdk28AndChangeDefaultSmsForAnotherAppAsHolderAndAllowThenTheOtherAppIsDefaultSms()
             throws Exception {
diff --git a/tests/tests/safetycenter/Android.bp b/tests/tests/safetycenter/Android.bp
index 726f8fd..dddd03c 100644
--- a/tests/tests/safetycenter/Android.bp
+++ b/tests/tests/safetycenter/Android.bp
@@ -35,6 +35,7 @@
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "kotlin-stdlib",
+        "kotlin-test",
         "modules-utils-build_system",
         "truth-prebuilt",
     ],
diff --git a/tests/tests/safetycenter/src/android/safetycenter/cts/SafetyCenterManagerTest.kt b/tests/tests/safetycenter/src/android/safetycenter/cts/SafetyCenterManagerTest.kt
index 4c8ba26..b3a290a 100644
--- a/tests/tests/safetycenter/src/android/safetycenter/cts/SafetyCenterManagerTest.kt
+++ b/tests/tests/safetycenter/src/android/safetycenter/cts/SafetyCenterManagerTest.kt
@@ -22,7 +22,9 @@
 import android.content.Intent
 import android.content.Intent.ACTION_SAFETY_CENTER
 import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
+import android.content.res.Resources
 import android.os.Build.VERSION_CODES.TIRAMISU
+import android.provider.DeviceConfig
 import android.safetycenter.SafetyCenterManager
 import android.safetycenter.SafetySourceData
 import android.safetycenter.SafetySourceIssue
@@ -37,6 +39,7 @@
 import com.google.common.truth.Truth.assertThat
 import org.junit.Test
 import org.junit.runner.RunWith
+import kotlin.test.assertFailsWith
 
 @RunWith(AndroidJUnit4::class)
 @SdkSuppress(minSdkVersion = TIRAMISU, codeName = "Tiramisu")
@@ -106,4 +109,106 @@
 
         assertThat(lastSafetyCenterUpdate).isEqualTo(secondSafetyCenterUpdate)
     }
+
+    @Test
+    fun isSafetyCenterEnabled_whenConfigEnabled_andFlagEnabled_returnsTrue() {
+        if (!deviceSupportsSafetyCenter()) {
+            return
+        }
+
+        runWithShellPermissionIdentity {
+            DeviceConfig.setProperty(
+                    DeviceConfig.NAMESPACE_PRIVACY,
+                    PROPERTY_SAFETY_CENTER_ENABLED,
+                    /* value = */ true.toString(),
+                    /* makeDefault = */ false)
+        }
+
+        val isSafetyCenterEnabled = callWithShellPermissionIdentity {
+            safetyCenterManager.isSafetyCenterEnabled
+        }
+
+        assertThat(isSafetyCenterEnabled).isTrue()
+    }
+
+    @Test
+    fun isSafetyCenterEnabled_whenConfigEnabled_andFlagDisabled_returnsFalse() {
+        if (!deviceSupportsSafetyCenter()) {
+            return
+        }
+
+        runWithShellPermissionIdentity {
+            DeviceConfig.setProperty(
+                    DeviceConfig.NAMESPACE_PRIVACY,
+                    PROPERTY_SAFETY_CENTER_ENABLED,
+                    /* value = */ false.toString(),
+                    /* makeDefault = */ false)
+        }
+
+        val isSafetyCenterEnabled = callWithShellPermissionIdentity {
+            safetyCenterManager.isSafetyCenterEnabled
+        }
+
+        assertThat(isSafetyCenterEnabled).isFalse()
+    }
+
+    @Test
+    fun isSafetyCenterEnabled_whenConfigDisabled_andFlagEnabled_returnsFalse() {
+        if (deviceSupportsSafetyCenter()) {
+            return
+        }
+
+        runWithShellPermissionIdentity {
+            DeviceConfig.setProperty(
+                    DeviceConfig.NAMESPACE_PRIVACY,
+                    PROPERTY_SAFETY_CENTER_ENABLED,
+                    /* value = */ true.toString(),
+                    /* makeDefault = */ false)
+        }
+
+        val isSafetyCenterEnabled = callWithShellPermissionIdentity {
+            safetyCenterManager.isSafetyCenterEnabled
+        }
+
+        assertThat(isSafetyCenterEnabled).isFalse()
+    }
+
+    @Test
+    fun isSafetyCenterEnabled_whenConfigDisabled_andFlagDisabled_returnsFalse() {
+        if (deviceSupportsSafetyCenter()) {
+            return
+        }
+
+        runWithShellPermissionIdentity {
+            DeviceConfig.setProperty(
+                    DeviceConfig.NAMESPACE_PRIVACY,
+                    PROPERTY_SAFETY_CENTER_ENABLED,
+                    /* value = */ false.toString(),
+                    /* makeDefault = */ false)
+        }
+
+        val isSafetyCenterEnabled = callWithShellPermissionIdentity {
+            safetyCenterManager.isSafetyCenterEnabled
+        }
+
+        assertThat(isSafetyCenterEnabled).isFalse()
+    }
+
+    @Test
+    fun isSafetyCenterEnabled_whenAppDoesntHoldPermission_methodThrows() {
+        assertFailsWith(SecurityException::class) {
+            safetyCenterManager.isSafetyCenterEnabled
+        }
+    }
+
+    private fun deviceSupportsSafetyCenter() =
+            context.resources.getBoolean(Resources.getSystem().getIdentifier(
+                    "config_enableSafetyCenter",
+                    "bool",
+                    "android"))
+
+    companion object {
+        /** Name of the flag that determines whether SafetyCenter is enabled. */
+        const val PROPERTY_SAFETY_CENTER_ENABLED = "safety_center_is_enabled"
+    }
 }
diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0922.java b/tests/tests/security/src/android/security/cts/CVE_2021_0922.java
new file mode 100644
index 0000000..855ad37
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/CVE_2021_0922.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2021 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;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeNoException;
+
+import android.app.Instrumentation;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.platform.test.annotations.AsbSecurityTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class CVE_2021_0922 {
+
+    private Instrumentation mInstrumentation;
+
+    @Before
+    public void setUp() {
+        mInstrumentation = InstrumentationRegistry.getInstrumentation();
+    }
+
+    /**
+     * b/195630721
+     */
+    @AsbSecurityTest(cveBugId = 195630721)
+    @Test
+    public void testPocCVE_2021_0922() throws Exception {
+        String packageName = "com.android.managedprovisioning";
+        try {
+            PackageInfo packageInfo = mInstrumentation.getContext().getPackageManager()
+                    .getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
+            boolean isPermissionPresent = false;
+            for (int i = 0; i < packageInfo.requestedPermissions.length; ++i) {
+                if ((packageInfo.requestedPermissionsFlags[i]
+                        & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0) {
+                    String permission = packageInfo.requestedPermissions[i];
+                    if (permission.equals(android.Manifest.permission.MANAGE_APP_OPS_MODES)) {
+                        isPermissionPresent = true;
+                        break;
+                    }
+                }
+            }
+            assertTrue(isPermissionPresent);
+        } catch (PackageManager.NameNotFoundException e) {
+            assumeNoException(e);
+        }
+    }
+}
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 29ecaca6..6820f2c 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -1151,7 +1151,7 @@
     }
 
     @Test
-    @AsbSecurityTest(cveBugId = 110435401)
+    @AsbSecurityTest(cveBugId = 68664359)
     public void testStagefright_bug_110435401() throws Exception {
         doStagefrightTest(R.raw.bug_110435401, 60000);
     }
diff --git a/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java b/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java
index b6103c8..bd7e263 100644
--- a/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java
+++ b/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java
@@ -52,14 +52,7 @@
 
     @Before
     public void setUp() throws Exception {
-        // runOnMainSync or SplitController#isSplitSupported will return wrong value for large
-        // screen devices.
-        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
-            @Override
-            public void run() {
-                mIsSplitSupported = SplitController.getInstance().isSplitSupported();
-            }
-        });
+        mIsSplitSupported = SplitController.getInstance().isSplitSupported();
         mDeepLinkIntentResolveInfo = InstrumentationRegistry.getInstrumentation().getContext()
                 .getPackageManager().resolveActivity(
                 new Intent(Settings.ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY),
diff --git a/tests/tests/systemui/Android.bp b/tests/tests/systemui/Android.bp
index 4c90df3..0d28f65 100644
--- a/tests/tests/systemui/Android.bp
+++ b/tests/tests/systemui/Android.bp
@@ -39,7 +39,6 @@
         "androidx.test.ext.junit",
         "androidx.test.uiautomator",
         "cts-wm-util",
-        "permission-test-util-lib",
         "ub-uiautomator",
     ],
     srcs: [
diff --git a/tests/tests/systemui/AndroidManifest.xml b/tests/tests/systemui/AndroidManifest.xml
index d4ba3b3..f55ed3f 100644
--- a/tests/tests/systemui/AndroidManifest.xml
+++ b/tests/tests/systemui/AndroidManifest.xml
@@ -26,7 +26,6 @@
     <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
     <!-- Required by flickerlib to dump window states -->
     <uses-permission android:name="android.permission.DUMP"/>
-    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
 
     <application android:requestLegacyExternalStorage="true">
         <activity android:name=".LightBarActivity"
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
index e8d2f9d..ffa58ba 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
@@ -16,7 +16,6 @@
 
 package android.systemui.cts;
 
-import static android.Manifest.permission.POST_NOTIFICATIONS;
 import static android.server.wm.BarTestUtils.assumeHasColoredNavigationBar;
 import static android.server.wm.BarTestUtils.assumeHasColoredStatusBar;
 import static android.server.wm.BarTestUtils.assumeStatusBarContainsCutout;
@@ -35,7 +34,6 @@
 import android.graphics.Color;
 import android.graphics.Insets;
 import android.os.SystemClock;
-import android.permission.cts.PermissionUtils;
 import android.platform.test.annotations.AppModeFull;
 import android.view.Gravity;
 import android.view.InputDevice;
@@ -49,8 +47,6 @@
 
 import com.android.compatibility.common.util.ThrowingRunnable;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -90,18 +86,6 @@
     @Rule
     public TestName mTestName = new TestName();
 
-    @Before
-    public void setUp() throws Exception {
-        PermissionUtils.grantPermission(
-                mActivityRule.getActivity().getPackageName(), POST_NOTIFICATIONS);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        PermissionUtils.revokePermission(
-                mActivityRule.getActivity().getPackageName(), POST_NOTIFICATIONS);
-    }
-
     @Test
     @AppModeFull // Instant apps cannot create notifications
     public void testLightStatusBarIcons() throws Throwable {
diff --git a/tests/tests/telecom/src/android/telecom/cts/EmergencyCallTests.java b/tests/tests/telecom/src/android/telecom/cts/EmergencyCallTests.java
index 0eca1fd..e91c831 100644
--- a/tests/tests/telecom/src/android/telecom/cts/EmergencyCallTests.java
+++ b/tests/tests/telecom/src/android/telecom/cts/EmergencyCallTests.java
@@ -54,6 +54,8 @@
      * @throws Exception
      */
     public void testEmergencyCallFailureDueToInvalidPhoneAccounts() throws Exception {
+        if (!mShouldTestTelecom) return;
+
         ArrayList<PhoneAccount> accounts = generateRandomPhoneAccounts(52L, 50);
         accounts.stream().forEach(a -> mTelecomManager.registerPhoneAccount(a));
         try {
diff --git a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
index 0b74a9e..a31e90f 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
@@ -335,7 +335,7 @@
         }
         final PackageManager pm = context.getPackageManager();
         return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) &&
-                pm.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE);
+                pm.hasSystemFeature(PackageManager.FEATURE_TELECOM);
     }
 
     public static String setCallDiagnosticService(Instrumentation instrumentation,
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
index 4597a54..e7441ae 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
@@ -35,7 +35,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
+import static org.junit.Assume.assumeTrue;
 
 import android.app.UiAutomation;
 import android.content.BroadcastReceiver;
@@ -70,7 +70,6 @@
     private CarrierConfigManager mConfigManager;
     private TelephonyManager mTelephonyManager;
     private SubscriptionManager mSubscriptionManager;
-    private PackageManager mPackageManager;
 
     // Use a long timeout to accommodate devices with lower amounts of memory, as it will take
     // longer for these devices to receive the broadcast (b/161963269). It is expected that all
@@ -80,6 +79,8 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
         mTelephonyManager = (TelephonyManager)
                 getContext().getSystemService(Context.TELEPHONY_SERVICE);
         mConfigManager = (CarrierConfigManager)
@@ -87,7 +88,6 @@
         mSubscriptionManager =
                 (SubscriptionManager)
                         getContext().getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
-        mPackageManager = getContext().getPackageManager();
     }
 
     @After
@@ -207,9 +207,6 @@
     @Test
     @AsbSecurityTest(cveBugId = 73136824)
     public void testRevokePermission() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
         PersistableBundle config;
 
         try {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
index bae1f29..ea5d1ee 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
@@ -45,23 +45,27 @@
         }
     }
 
+    @Override
+    protected void runTest() throws Throwable {
+        if (!hasCellular()) {
+            return;
+        }
+        super.runTest();
+    }
+
     private static boolean hasCellular() {
         PackageManager packageManager = getInstrumentation().getContext().getPackageManager();
         TelephonyManager telephonyManager =
                 getInstrumentation().getContext().getSystemService(TelephonyManager.class);
-        return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
+        return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)
                 && telephonyManager.getPhoneCount() > 0;
     }
 
     public void testNotifyCarrierNetworkChange_true() {
-        if (!mHasCellular) return;
-
         notifyCarrierNetworkChange(true);
     }
 
     public void testNotifyCarrierNetworkChange_false() {
-        if (!mHasCellular) return;
-
         notifyCarrierNetworkChange(false);
     }
 
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/IRadioNetworkImpl.java b/tests/tests/telephony/current/src/android/telephony/cts/IRadioNetworkImpl.java
index 0891dac..02ca850 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/IRadioNetworkImpl.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/IRadioNetworkImpl.java
@@ -129,7 +129,12 @@
 
         android.hardware.radio.network.RegStateResult dataRegResponse =
                 new android.hardware.radio.network.RegStateResult();
-        RadioResponseInfo rsp = mService.makeSolRsp(serial, RadioError.REQUEST_NOT_SUPPORTED);
+        dataRegResponse.accessTechnologySpecificInfo =
+                android.hardware.radio.network.AccessTechnologySpecificInfo.noinit(true);
+        dataRegResponse.cellIdentity =
+                android.hardware.radio.network.CellIdentity.noinit(true);
+
+        RadioResponseInfo rsp = mService.makeSolRsp(serial);
         try {
             mRadioNetworkResponse.getDataRegistrationStateResponse(rsp, dataRegResponse);
         } catch (RemoteException ex) {
@@ -223,7 +228,12 @@
 
         android.hardware.radio.network.RegStateResult voiceRegResponse =
                 new android.hardware.radio.network.RegStateResult();
-        RadioResponseInfo rsp = mService.makeSolRsp(serial, RadioError.REQUEST_NOT_SUPPORTED);
+        voiceRegResponse.accessTechnologySpecificInfo =
+                android.hardware.radio.network.AccessTechnologySpecificInfo.noinit(true);
+        voiceRegResponse.cellIdentity =
+                android.hardware.radio.network.CellIdentity.noinit(true);
+
+        RadioResponseInfo rsp = mService.makeSolRsp(serial);
         try {
             mRadioNetworkResponse.getVoiceRegistrationStateResponse(rsp, voiceRegResponse);
         } catch (RemoteException ex) {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/MmsTest.java b/tests/tests/telephony/current/src/android/telephony/cts/MmsTest.java
index dfcaf2c..fe9cf2c 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/MmsTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/MmsTest.java
@@ -20,6 +20,7 @@
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 import android.app.Activity;
 import android.app.PendingIntent;
@@ -94,7 +95,6 @@
     private Random mRandom;
     private SentReceiver mSentReceiver;
     private TelephonyManager mTelephonyManager;
-    private PackageManager mPackageManager;
 
     private static class SentReceiver extends BroadcastReceiver {
         private final Object mLock;
@@ -174,7 +174,8 @@
         mRandom = new Random();
         mTelephonyManager =
                 (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
-        mPackageManager = getContext().getPackageManager();
+        assumeTrue(getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_MESSAGING));
     }
 
     @Test
@@ -196,8 +197,7 @@
 
     private void sendMmsMessage(long messageId, int expectedErrorResultCode,
             SmsManager smsManager) {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-             || !doesSupportMMS()) {
+        if (!doesSupportMMS()) {
             Log.i(TAG, "testSendMmsMessage skipped: no telephony available or MMS not supported");
             return;
         }
@@ -360,8 +360,7 @@
     }
 
     private void downloadMultimediaMessage(long messageId) {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || !doesSupportMMS()) {
+        if (!doesSupportMMS()) {
             Log.i(TAG, "testSendMmsMessage skipped: no telephony available or MMS not supported");
             return;
         }
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index 8a13736..5ee3d44 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -112,7 +112,6 @@
     private static final String FINANCIAL_SMS_APP = "android.telephony.cts.financialsms";
 
     private TelephonyManager mTelephonyManager;
-    private PackageManager mPackageManager;
     private String mDestAddr;
     private String mText;
     private SmsBroadcastReceiver mSendReceiver;
@@ -139,24 +138,19 @@
 
     @Before
     public void setUp() throws Exception {
-        assumeTrue(InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY));
+        assumeTrue(getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_MESSAGING));
 
         mContext = getContext();
         mTelephonyManager =
             (TelephonyManager) getContext().getSystemService(
                     Context.TELEPHONY_SERVICE);
-        mPackageManager = mContext.getPackageManager();
         mDestAddr = mTelephonyManager.getLine1Number();
         mText = "This is a test message";
 
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            mDeliveryReportSupported = false;
-        } else {
-            // exclude the networks that don't support SMS delivery report
-            String mccmnc = mTelephonyManager.getSimOperator();
-            mDeliveryReportSupported = !(CarrierCapability.NO_DELIVERY_REPORTS.contains(mccmnc));
-        }
+        // exclude the networks that don't support SMS delivery report
+        String mccmnc = mTelephonyManager.getSimOperator();
+        mDeliveryReportSupported = !(CarrierCapability.NO_DELIVERY_REPORTS.contains(mccmnc));
 
         // register receivers
         mSendIntent = new Intent(SMS_SEND_ACTION);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
index 615c2a8..c7065b7 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
@@ -26,6 +26,8 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -88,18 +90,18 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_MESSAGING));
+        mPackageManager = getContext().getPackageManager();
         mTelephonyManager =
             (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
-        mPackageManager = getContext().getPackageManager();
     }
 
     @Test
     public void testCreateFromPdu() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA)) {
-            // TODO: temp workaround, need to adjust test to use CDMA pdus
-            return;
-        }
+        // TODO: temp workaround, need to adjust test to use CDMA pdus
+        assumeFalse(mPackageManager.hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_CDMA));
 
         String pdu = "07916164260220F0040B914151245584F600006060605130308A04D4F29C0E";
         SmsMessage sms = SmsMessage.createFromPdu(hexStringToByteArray(pdu),
@@ -179,11 +181,9 @@
 
     @Test
     public void testCPHSVoiceMail() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA)) {
-            // TODO: temp workaround, need to adjust test to use CDMA pdus
-            return;
-        }
+        // TODO: temp workaround, need to adjust test to use CDMA pdus
+        assumeFalse(mPackageManager.hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_CDMA));
 
         // "set MWI flag"
         String pdu = "07912160130310F20404D0110041006060627171118A0120";
@@ -223,11 +223,9 @@
 
     @Test
     public void testGetUserData() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA)) {
-            // TODO: temp workaround, need to adjust test to use CDMA pdus
-            return;
-        }
+        // TODO: temp workaround, need to adjust test to use CDMA pdus
+        assumeFalse(mPackageManager.hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_CDMA));
 
         String pdu = "07914140279510F6440A8111110301003BF56080207130138A8C0B05040B8423F"
             + "000032A02010106276170706C69636174696F6E2F766E642E7761702E6D6D732D"
@@ -243,10 +241,6 @@
 
     @Test
     public void testGetSubmitPdu() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         SmsMessage.SubmitPdu smsPdu;
         String scAddress = null, destinationAddress = null;
         String message = null;
@@ -284,11 +278,9 @@
 
     @Test
     public void testEmailGateway() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA)) {
-            // TODO: temp workaround, need to adjust test to use CDMA pdus
-            return;
-        }
+        // TODO: temp workaround, need to adjust test to use CDMA pdus
+        assumeFalse(mPackageManager.hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_CDMA));
 
         String pdu = "07914151551512f204038105f300007011103164638a28e6f71b50c687db" +
                          "7076d9357eb7412f7a794e07cdeb6275794c07bde8e5391d247e93f3";
@@ -317,10 +309,6 @@
 
     @Test
     public void testCalculateLength() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         int[] result = SmsMessage.calculateLength(LONG_TEXT_WITH_32BIT_CHARS, false);
         assertEquals(6, result.length);
         assertEquals(3, result[0]);
@@ -343,19 +331,12 @@
 
     @Test
     public void testCalculateLengthFlags() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
         int[] result = SmsMessage.calculateLength(LONG_TEXT_WITH_FLAGS, false);
         assertEquals(2, result[0]);
     }
 
     @Test
     public void testGetSmsPdu() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         SmsMessage.SubmitPdu smsPdu;
         String scAddress = null;
         String destinationAddress = null;
@@ -391,9 +372,6 @@
 
     @Test
     public void testGetSubmitPduEncodedMessage() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
         String destinationAddress = "18004664411";
         String message = "This is a test message";
 
@@ -433,9 +411,6 @@
 
     @Test
     public void testCreateFromNativeSmsSubmitPdu() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
         // Short message with status RECEIVED_READ and size 0. See 3GPP2 C.S0023 3.4.27
         byte[] submitPdu = {1, 0};
         SmsMessage sms = SmsMessage.createFromNativeSmsSubmitPdu(submitPdu, true);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
index 32c4258..def4335 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
@@ -17,25 +17,23 @@
 package android.telephony.cts;
 
 import static android.telephony.SmsManager.SMS_CATEGORY_FREE_SHORT_CODE;
-import static android.telephony.SmsManager.SMS_CATEGORY_STANDARD_SHORT_CODE;
 import static android.telephony.SmsManager.SMS_CATEGORY_NOT_SHORT_CODE;
 import static android.telephony.SmsManager.SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
 import static android.telephony.SmsManager.SMS_CATEGORY_PREMIUM_SHORT_CODE;
+import static android.telephony.SmsManager.SMS_CATEGORY_STANDARD_SHORT_CODE;
 
 import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
-import android.telephony.SmsManager;
-import android.test.InstrumentationTestCase;
 import android.telephony.PhoneNumberUtils;
+import android.telephony.SmsManager;
 
 import androidx.test.annotation.UiThreadTest;
 
-import com.android.internal.telephony.SmsUsageMonitor;
-
 import org.junit.Before;
 import org.junit.Test;
 
@@ -44,7 +42,6 @@
  */
 public class SmsUsageMonitorShortCodeTest {
 
-    private PackageManager mPackageManager;
     private Context mContext;
 
     private static final class ShortCodeTest {
@@ -475,7 +472,8 @@
     @Before
     public void setUp() throws Exception {
         mContext = getInstrumentation().getTargetContext();
-        mPackageManager = mContext.getPackageManager();
+        assumeTrue(mContext.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_MESSAGING));
     }
 
     private static int expectedReturnCode(String address) {
@@ -486,11 +484,6 @@
     @UiThreadTest
     @Test
     public void testSmsShortCodeDestination() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            // do not test if device does not support telephony (voice or sms)
-            return;
-        }
-
         for (ShortCodeTest test : sShortCodeTests) {
             // It is intended that a short code number in country A may be an emergency number
             // in country B. It is intended that the destination will be changed because of this
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index f40e08f..041c133 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -30,6 +30,7 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
 
 import android.annotation.Nullable;
 import android.app.UiAutomation;
@@ -205,7 +206,7 @@
 
     @Before
     public void setUp() throws Exception {
-        if (!isSupported()) return;
+        assumeTrue(isSupported());
 
         mSm = InstrumentationRegistry.getContext().getSystemService(SubscriptionManager.class);
         mSubId = SubscriptionManager.getDefaultDataSubscriptionId();
@@ -229,34 +230,25 @@
      */
     @Test
     public void testCorrectness() throws Exception {
-        if (!isSupported()) return;
-
         final boolean hasCellular = findCellularNetwork() != null;
-        if (isSupported() && !hasCellular) {
+        if (!hasCellular) {
             fail("Device claims to support " + PackageManager.FEATURE_TELEPHONY
                     + " but has no active cellular network, which is required for validation");
-        } else if (!isSupported() && hasCellular) {
-            fail("Device has active cellular network, but claims to not support "
-                    + PackageManager.FEATURE_TELEPHONY);
         }
 
-        if (isSupported()) {
-            if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
-                fail("Device must have a valid default data subId for validation");
-            }
+        if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            fail("Device must have a valid default data subId for validation");
         }
     }
 
     @Test
     public void testGetActiveSubscriptionInfoCount() throws Exception {
-        if (!isSupported()) return;
         assertTrue(mSm.getActiveSubscriptionInfoCount() <=
                 mSm.getActiveSubscriptionInfoCountMax());
     }
 
     @Test
     public void testGetActiveSubscriptionInfoForIcc() throws Exception {
-        if (!isSupported()) return;
         SubscriptionInfo info = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
                 (sm) -> sm.getActiveSubscriptionInfo(mSubId));
         assertNotNull(ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
@@ -265,13 +257,11 @@
 
     @Test
     public void testIsActiveSubscriptionId() throws Exception {
-        if (!isSupported()) return;
         assertTrue(mSm.isActiveSubscriptionId(mSubId));
     }
 
     @Test
     public void testGetSubscriptionIds() throws Exception {
-        if (!isSupported()) return;
         int slotId = SubscriptionManager.getSlotIndex(mSubId);
         int[] subIds = mSm.getSubscriptionIds(slotId);
         assertNotNull(subIds);
@@ -280,7 +270,6 @@
 
     @Test
     public void testGetResourcesForSubId() {
-        if (!isSupported()) return;
         Resources r = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
                 (sm) -> sm.getResourcesForSubId(InstrumentationRegistry.getContext(), mSubId));
         // this is an old method which returns mcc/mnc as ints, so use the old SM.getMcc/Mnc methods
@@ -291,14 +280,11 @@
 
     @Test
     public void testIsUsableSubscriptionId() throws Exception {
-        if (!isSupported()) return;
         assertTrue(SubscriptionManager.isUsableSubscriptionId(mSubId));
     }
 
     @Test
     public void testActiveSubscriptions() throws Exception {
-        if (!isSupported()) return;
-
         List<SubscriptionInfo> subList = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
                 (sm) -> sm.getActiveSubscriptionInfoList());
         int[] idList = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
@@ -324,8 +310,6 @@
 
     @Test
     public void testSubscriptionPlans() throws Exception {
-        if (!isSupported()) return;
-
         // Make ourselves the owner
         setSubPlanOwner(mSubId, mPackageName);
 
@@ -354,8 +338,6 @@
 
     @Test
     public void testSubscriptionPlansOverrideCongested() throws Exception {
-        if (!isSupported()) return;
-
         final ConnectivityManager cm = InstrumentationRegistry.getContext()
                 .getSystemService(ConnectivityManager.class);
         final Network net = findCellularNetwork();
@@ -410,7 +392,7 @@
 
     @Test
     public void testSubscriptionInfoRecord() {
-        if (!isSupported() || !isAutomotive()) return;
+        if (!isAutomotive()) return;
 
         UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
         uiAutomation.adoptShellPermissionIdentity();
@@ -439,8 +421,6 @@
 
     @Test
     public void testSetDefaultVoiceSubId() {
-        if (!isSupported()) return;
-
         int oldSubId = SubscriptionManager.getDefaultVoiceSubscriptionId();
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity();
@@ -458,8 +438,6 @@
 
     @Test
     public void testSubscriptionPlansOverrideUnmetered() throws Exception {
-        if (!isSupported()) return;
-
         final ConnectivityManager cm = InstrumentationRegistry.getContext()
                 .getSystemService(ConnectivityManager.class);
         final Network net = findCellularNetwork();
@@ -495,8 +473,6 @@
 
     @Test
     public void testSubscriptionPlansUnmetered() throws Exception {
-        if (!isSupported()) return;
-
         final ConnectivityManager cm = InstrumentationRegistry.getContext()
                 .getSystemService(ConnectivityManager.class);
         final Network net = findCellularNetwork();
@@ -544,8 +520,6 @@
 
     @Test
     public void testSubscriptionPlansInvalid() throws Exception {
-        if (!isSupported()) return;
-
         // Make ourselves the owner
         setSubPlanOwner(mSubId, mPackageName);
 
@@ -585,8 +559,6 @@
 
     @Test
     public void testSubscriptionPlansNetworkTypeValidation() throws Exception {
-        if (!isSupported()) return;
-
         // Make ourselves the owner
         setSubPlanOwner(mSubId, mPackageName);
 
@@ -643,8 +615,6 @@
 
     @Test
     public void testSubscriptionGrouping() throws Exception {
-        if (!isSupported()) return;
-
         // Set subscription group with current sub Id. This should fail
         // because we don't have MODIFY_PHONE_STATE or carrier privilege permission.
         List<Integer> subGroup = new ArrayList();
@@ -688,8 +658,6 @@
 
     @Test
     public void testSubscriptionGroupingWithPermission() throws Exception {
-        if (!isSupported()) return;
-
         // Set subscription group with current sub Id.
         List<Integer> subGroup = new ArrayList();
         subGroup.add(mSubId);
@@ -745,8 +713,6 @@
 
     @Test
     public void testAddSubscriptionIntoNewGroupWithPermission() throws Exception {
-        if (!isSupported()) return;
-
         // Set subscription group with current sub Id.
         List<Integer> subGroup = new ArrayList();
         subGroup.add(mSubId);
@@ -777,8 +743,6 @@
 
     @Test
     public void testSettingOpportunisticSubscription() throws Exception {
-        if (!isSupported()) return;
-
         // Set subscription to be opportunistic. This should fail
         // because we don't have MODIFY_PHONE_STATE or carrier privilege permission.
         try {
@@ -794,8 +758,6 @@
 
     @Test
     public void testMccMncString() {
-        if (!isSupported()) return;
-
         SubscriptionInfo info = mSm.getActiveSubscriptionInfo(mSubId);
         String mcc = info.getMccString();
         String mnc = info.getMncString();
@@ -805,8 +767,6 @@
 
     @Test
     public void testSetUiccApplicationsEnabled() throws Exception {
-        if (!isSupported()) return;
-
         boolean canDisable = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
                 (sm) -> sm.canDisablePhysicalSubscription());
         if (canDisable) {
@@ -884,8 +844,6 @@
 
     @Test
     public void testSubscriptionInfoCarrierId() {
-        if (!isSupported()) return;
-
         SubscriptionInfo info = mSm.getActiveSubscriptionInfo(mSubId);
         int carrierId = info.getCarrierId();
         assertTrue(carrierId >= TelephonyManager.UNKNOWN_CARRIER_ID);
@@ -893,8 +851,6 @@
 
     @Test
     public void testGetOpportunisticSubscriptions() throws Exception {
-        if (!isSupported()) return;
-
         List<SubscriptionInfo> infoList = mSm.getOpportunisticSubscriptions();
 
         for (SubscriptionInfo info : infoList) {
@@ -904,7 +860,6 @@
 
     @Test
     public void testGetEnabledSubscriptionId() {
-        if (!isSupported()) return;
         int slotId = SubscriptionManager.getSlotIndex(mSubId);
         if (!SubscriptionManager.isValidSlotIndex(slotId)) {
             fail("Invalid slot id " + slotId + " for subscription id " + mSubId);
@@ -916,7 +871,6 @@
 
     @Test
     public void testSetAndCheckSubscriptionEnabled() {
-        if (!isSupported()) return;
         boolean enabled = executeWithShellPermissionAndDefault(false, mSm,
                 (sm) -> sm.isSubscriptionEnabled(mSubId));
 
@@ -1005,8 +959,6 @@
 
     @Test
     public void testGetActiveDataSubscriptionId() {
-        if (!isSupported()) return;
-
         int activeDataSubIdCurrent = executeWithShellPermissionAndDefault(
                 SubscriptionManager.INVALID_SUBSCRIPTION_ID, mSm,
                 (sm) -> sm.getActiveDataSubscriptionId());
@@ -1021,7 +973,6 @@
 
     @Test
     public void testSetPreferredDataSubscriptionId() {
-        if (!isSupported()) return;
         int preferredSubId = executeWithShellPermissionAndDefault(-1, mSm,
                 (sm) -> sm.getPreferredDataSubscriptionId());
         if (preferredSubId != SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
@@ -1043,8 +994,6 @@
 
     @Test
     public void testRestoreAllSimSpecificSettingsFromBackup() throws Exception {
-        if (!isSupported()) return;
-
         int activeDataSubId = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
                 (sm) -> sm.getActiveDataSubscriptionId());
         assertNotEquals(activeDataSubId, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -1148,8 +1097,6 @@
 
     @Test
     public void testSetAndGetD2DStatusSharing() {
-        if (!isSupported()) return;
-
         UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
         uiAutomation.adoptShellPermissionIdentity(MODIFY_PHONE_STATE);
         int originalD2DStatusSharing = mSm.getDeviceToDeviceStatusSharingPreference(mSubId);
@@ -1166,8 +1113,6 @@
 
     @Test
     public void testSetAndGetD2DSharingContacts() {
-        if (!isSupported()) return;
-
         UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
         uiAutomation.adoptShellPermissionIdentity(MODIFY_PHONE_STATE);
         List<Uri> originalD2DSharingContacts = mSm.getDeviceToDeviceStatusSharingContacts(mSubId);
@@ -1179,8 +1124,6 @@
 
     @Test
     public void tetsSetAndGetPhoneNumber() throws Exception {
-        if (!isSupported()) return;
-
         // The phone number may be anything depends on the state of SIM and device.
         // Simply call the getter and make sure no exception.
 
@@ -1431,8 +1374,8 @@
     }
 
     private static boolean isSupported() {
-        return InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+        return InstrumentationRegistry.getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION);
     }
 
     private static boolean isAutomotive() {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 40fe9e2..ec317ee 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -32,6 +32,7 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
 
 import android.Manifest.permission;
 import android.annotation.NonNull;
@@ -335,8 +336,10 @@
     @Before
     public void setUp() throws Exception {
         mCm = getContext().getSystemService(ConnectivityManager.class);
-        mSubscriptionManager = getContext().getSystemService(SubscriptionManager.class);
         mPackageManager = getContext().getPackageManager();
+        assumeTrue(mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY));
+
+        mSubscriptionManager = getContext().getSystemService(SubscriptionManager.class);
         mCarrierConfigManager = getContext().getSystemService(CarrierConfigManager.class);
         mSelfPackageName = getContext().getPackageName();
         mSelfCertHash = getCertHash(mSelfPackageName);
@@ -376,7 +379,6 @@
     }
 
     private void saveAllowedNetworkTypesForAllReasons() {
-        if (!hasCellular()) return;
         mIsAllowedNetworkTypeChanged = false;
         if (mAllowedNetworkTypesList == null) {
             mAllowedNetworkTypesList = new HashMap<>();
@@ -444,15 +446,14 @@
         }
     }
 
-    /** Checks whether the cellular stack should be running on this device. */
-    private boolean hasCellular() {
-        return mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                && mTelephonyManager.getPhoneCount() > 0;
+    /** Checks whether the telephony feature is supported. */
+    private boolean hasFeature(String feature) {
+        return mPackageManager.hasSystemFeature(feature);
     }
 
     @Test
     public void testHasCarrierPrivilegesViaCarrierConfigs() throws Exception {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
         PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mTestSub);
 
         try {
@@ -504,10 +505,8 @@
 
     @Test
     public void testDevicePolicyApn() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
+
         // These methods aren't accessible to anything except system and phone by design, so we just
         // look for security exceptions here.
         try {
@@ -549,12 +548,6 @@
 
     @Test
     public void testListen() throws Throwable {
-        if (!InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires PackageManager.FEATURE_TELEPHONY");
-            return;
-        }
-
         if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
             // TODO: temp workaround, need to adjust test to for CDMA
             return;
@@ -636,11 +629,6 @@
      */
     @Test
     public void testTelephonyManager() {
-        if (!InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires PackageManager.FEATURE_TELEPHONY");
-            return;
-        }
         assertTrue(mTelephonyManager.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UNKNOWN);
         assertTrue(mTelephonyManager.getPhoneType() >= TelephonyManager.PHONE_TYPE_NONE);
         assertTrue(mTelephonyManager.getSimState() >= TelephonyManager.SIM_STATE_UNKNOWN);
@@ -775,10 +763,8 @@
 
     @Test
     public void testGetCallForwarding() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
+
         List<Integer> callForwardingReasons = new ArrayList<>();
         callForwardingReasons.add(CallForwardingInfo.REASON_UNCONDITIONAL);
         callForwardingReasons.add(CallForwardingInfo.REASON_BUSY);
@@ -841,10 +827,8 @@
 
     @Test
     public void testSetCallForwarding() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
+
         List<Integer> callForwardingReasons = new ArrayList<>();
         callForwardingReasons.add(CallForwardingInfo.REASON_UNCONDITIONAL);
         callForwardingReasons.add(CallForwardingInfo.REASON_BUSY);
@@ -922,10 +906,8 @@
 
     @Test
     public void testSetCallWaitingStatus() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
+
         Set<Integer> validCallWaitingErrors = new HashSet<Integer>();
         validCallWaitingErrors.add(TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR);
         validCallWaitingErrors.add(TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED);
@@ -959,11 +941,6 @@
 
     @Test
     public void testGetRadioHalVersion() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG,"skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
-
         Pair<Integer, Integer> version = mTelephonyManager.getRadioHalVersion();
 
         // The version must be valid, and the versions start with 1.0
@@ -973,10 +950,6 @@
 
     @Test
     public void testCreateForPhoneAccountHandle() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
         if (!mTelephonyManager.isVoiceCapable()) {
             Log.d(TAG, "Skipping test that requires config_voice_capable is true");
             return;
@@ -1007,10 +980,6 @@
 
     @Test
     public void testGetPhoneAccountHandle() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
         TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
         PhoneAccountHandle defaultAccount = telecomManager
                 .getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
@@ -1064,11 +1033,6 @@
      */
     @Test
     public void testGetMaxNumberOfSimultaneouslyActiveSims() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
-
         int maxNum = mTelephonyManager.getMaxNumberOfSimultaneouslyActiveSims();
         assertTrue(maxNum >= 1);
     }
@@ -1246,30 +1210,26 @@
 
     @Test
     public void testGetNetworkCountryIso() {
-        if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            String countryCode = mTelephonyManager.getNetworkCountryIso();
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
+        String countryCode = mTelephonyManager.getNetworkCountryIso();
+        assertTrue("Country code '" + countryCode + "' did not match "
+                + ISO_COUNTRY_CODE_PATTERN,
+                Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
+
+        for (int i = 0; i < mTelephonyManager.getPhoneCount(); i++) {
+            countryCode = mTelephonyManager.getNetworkCountryIso(i);
+
             assertTrue("Country code '" + countryCode + "' did not match "
-                            + ISO_COUNTRY_CODE_PATTERN,
+                    + ISO_COUNTRY_CODE_PATTERN + " for slot " + i,
                     Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
-
-            for (int i = 0; i < mTelephonyManager.getPhoneCount(); i++) {
-                countryCode = mTelephonyManager.getNetworkCountryIso(i);
-
-                assertTrue("Country code '" + countryCode + "' did not match "
-                                + ISO_COUNTRY_CODE_PATTERN + " for slot " + i,
-                        Pattern.matches(ISO_COUNTRY_CODE_PATTERN, countryCode));
-            }
-        } else {
-            // Non-telephony may still have the property defined if it has a SIM.
         }
     }
 
     @Test
     public void testSetSystemSelectionChannels() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         LinkedBlockingQueue<Boolean> queue = new LinkedBlockingQueue<>(1);
         final UiAutomation uiAutomation =
                 InstrumentationRegistry.getInstrumentation().getUiAutomation();
@@ -1311,6 +1271,8 @@
 
     @Test
     public void testGetSimCountryIso() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         String countryCode = mTelephonyManager.getSimCountryIso();
         if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
             assertTrue("Country code '" + countryCode + "' did not match "
@@ -1323,11 +1285,6 @@
 
     @Test
     public void testResetSettings() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
-
         UserManager userManager = getContext().getSystemService(UserManager.class);
 
         boolean canChangeMobileNetworkSettings = userManager != null
@@ -1387,6 +1344,8 @@
 
     @Test
     public void testGetServiceState() throws InterruptedException {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
             Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
             return;
@@ -1458,6 +1417,8 @@
 
     @Test
     public void testGetServiceStateForInactiveSub() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
             Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
             return;
@@ -1480,6 +1441,8 @@
     @Test
     @CddTest(requirement = "7.4.1/C-4-1")
     public void testIWlanServiceState() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
             Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
             return;
@@ -1514,10 +1477,6 @@
 
     @Test
     public void testGetPhoneCapabilityAndVerify() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG,"skipping test that requires Telephony");
-            return;
-        }
         boolean is5gStandalone = getContext().getResources().getBoolean(
                 Resources.getSystem().getIdentifier("config_telephony5gStandalone", "bool",
                         "android"));
@@ -1626,10 +1585,6 @@
      */
     @Test
     public void testGetImeiForSlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         for (int i = 0; i < mTelephonyManager.getPhoneCount(); i++) {
             // The compiler error 'local variables referenced from a lambda expression must be final
             // or effectively final' is reported when using i, so assign it to a final variable.
@@ -1654,9 +1609,7 @@
      */
     @Test
     public void testGetRadioPowerState() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Also verify that no exception is thrown.
         assertThat(mTelephonyManager.getRadioPowerState()).isEqualTo(
@@ -1669,9 +1622,8 @@
      */
     @Test
     public void testSetCarrierDataEnabled() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
+
         // Also verify that no exception is thrown.
         ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
                 (tm) -> tm.setCarrierDataEnabled(false));
@@ -1685,9 +1637,8 @@
      */
     @Test
     public void testRebootRadio() throws Throwable {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         TestThread t = new TestThread(new Runnable() {
             public void run() {
                 Looper.prepare();
@@ -1783,9 +1734,8 @@
      */
     @Test
     public void testGetAidForAppType() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 (tm) -> tm.getAidForAppType(TelephonyManager.APPTYPE_SIM));
         ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
@@ -1803,9 +1753,8 @@
      */
     @Test
     public void testGetIsimDomain() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 (tm) -> tm.getIsimDomain());
     }
@@ -1817,9 +1766,8 @@
     @Ignore("API moved back to @hide for Android R.")
     @Test
     public void testGetIsimImpu() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 TelephonyManager::getIsimImpu);
         // Try without the correct permissions and ensure it fails.
@@ -1837,9 +1785,8 @@
      */
     @Test
     public void testNetworkRegistrationInfoRegisteredPlmn() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         // get NetworkRegistration object
         ServiceState ss = mTelephonyManager.getServiceState();
         assertNotNull(ss);
@@ -1871,9 +1818,8 @@
      */
     @Test
     public void testNetworkRegistrationInfoIsRoaming() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         // get NetworkRegistration object
         NetworkRegistrationInfo nwReg = mTelephonyManager.getServiceState()
                 .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
@@ -1889,9 +1835,8 @@
      */
     @Test
     public void testNetworkRegistrationInfoGetRoamingType() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         // get NetworkRegistration object for voice
         NetworkRegistrationInfo nwReg = mTelephonyManager.getServiceState()
                 .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
@@ -1915,9 +1860,8 @@
      */
     @Test
     public void testNetworkRegistationStateGetAccessNetworkTechnology() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         // get NetworkRegistration object for voice
         NetworkRegistrationInfo nwReg = mTelephonyManager.getServiceState()
                 .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
@@ -1939,6 +1883,8 @@
      */
     @Test
     public void testGetMeid() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CDMA));
+
         String meid = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 (tm) -> tm.getMeid());
 
@@ -1954,9 +1900,7 @@
      */
     @Test
     public void testGetMeidForSlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CDMA));
 
         SubscriptionManager sm = getContext().getSystemService(SubscriptionManager.class);
         List<SubscriptionInfo> subInfos = sm.getActiveSubscriptionInfoList();
@@ -1992,10 +1936,6 @@
      */
     @Test
     public void testSendDialerSpecialCode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
         try {
             mTelephonyManager.sendDialerSpecialCode("4636");
             fail("Expected SecurityException. App does not have carrier privileges or is not the "
@@ -2009,9 +1949,8 @@
      */
     @Test
     public void testGetForbiddenPlmns() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         String[] plmns = mTelephonyManager.getForbiddenPlmns();
 
         int phoneType = mTelephonyManager.getPhoneType();
@@ -2040,9 +1979,8 @@
      */
     @Test
     public void testSetForbiddenPlmns() {
-        if (!supportSetFplmn()) {
-            return;
-        }
+        assumeTrue(supportSetFplmn());
+
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
             int numFplmnsSet = ShellIdentityUtils.invokeMethodWithShellPermissions(
@@ -2064,9 +2002,8 @@
      */
     @Test
     public void testSetForbiddenPlmnsTruncate() {
-        if (!supportSetFplmn()) {
-            return;
-        }
+        assumeTrue(supportSetFplmn());
+
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
             List<String> targetFplmns = new ArrayList<>();
@@ -2097,9 +2034,8 @@
      */
     @Test
     public void testSetForbiddenPlmnsDelete() {
-        if (!supportSetFplmn()) {
-            return;
-        }
+        assumeTrue(supportSetFplmn());
+
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
             // Support test for empty SIM
@@ -2132,9 +2068,8 @@
      */
     @Test
     public void testSetForbiddenPlmnsVoid() {
-        if (!supportSetFplmn()) {
-            return;
-        }
+        assumeTrue(supportSetFplmn());
+
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
             ShellIdentityUtils.invokeMethodWithShellPermissions(
@@ -2150,9 +2085,7 @@
 
     @Test
     public void testGetEquivalentHomePlmns() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
 
         List<String> plmns = mTelephonyManager.getEquivalentHomePlmns();
 
@@ -2176,9 +2109,8 @@
      */
     @Test
     public void testGetManualNetworkSelectionPlmnNonPersisted() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
 
         try {
@@ -2200,9 +2132,8 @@
      */
     @Test
     public void testGetManualNetworkSelectionPlmnPersisted() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
 
         try {
@@ -2224,6 +2155,8 @@
      */
     @Test
     public void testGetCardIdForDefaultEuicc() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_EUICC));
+
         int cardId = mTelephonyManager.getCardIdForDefaultEuicc();
         assertTrue("Card ID for default EUICC is not a valid value",
                 cardId == TelephonyManager.UNSUPPORTED_CARD_ID
@@ -2236,10 +2169,8 @@
      */
     @Test
     public void testGetUiccCardsInfoException() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             // Requires READ_PRIVILEGED_PHONE_STATE or carrier privileges
             List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo();
@@ -2253,10 +2184,8 @@
      */
     @Test
     public void testGetUiccCardsInfo() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // Requires READ_PRIVILEGED_PHONE_STATE or carrier privileges
         List<UiccCardInfo> infos =
                 ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
@@ -2283,9 +2212,7 @@
      */
     @Test
     public void testGetNetworkSelectionMode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         try {
             ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
@@ -2305,10 +2232,8 @@
      */
     @Test
     public void testSetNetworkSelectionModeAutomatic() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         try {
             mTelephonyManager.setNetworkSelectionModeAutomatic();
             fail("Expected SecurityException. App does not have carrier privileges.");
@@ -2323,10 +2248,8 @@
      */
     @Test
     public void testSetNetworkSelectionModeManual() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         try {
             mTelephonyManager.setNetworkSelectionModeManual(
                     "" /* operatorNumeric */, false /* persistSelection */);
@@ -2340,10 +2263,8 @@
      */
     @Test
     public void testIsManualNetworkSelectionAllowed() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
 
         assertTrue(ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
@@ -2351,6 +2272,44 @@
     }
 
     /**
+     * Tests that the device properly sets the VoNr
+     */
+    @Test
+    public void testIsVoNrEnabled() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        try {
+            int result = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                    (tm) -> tm.setVoNrEnabled(true));
+            if (result ==  TelephonyManager.ENABLE_VONR_REQUEST_NOT_SUPPORTED) {
+                return;
+            }
+        } catch (Exception e) {
+        }
+
+        assertTrue(ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                (tm) -> tm.isVoNrEnabled()));
+    }
+
+    /**
+     * Tests that a SecurityException is thrown when trying to set VoNR
+     */
+    @Test
+    public void testSetVoNrEnabledException() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
+            return;
+        }
+        try {
+            mTelephonyManager.setVoNrEnabled(true);
+            fail("Expected SecurityException. App does not have carrier privileges.");
+        } catch (SecurityException expected) {
+        }
+    }
+
+    /**
      * Construct a CallAttributes object and test getters.
      */
     @Test
@@ -2407,9 +2366,8 @@
      */
     @Test
     public void testGetEmergencyNumberList() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
+
         Map<Integer, List<EmergencyNumber>> emergencyNumberList =
                 mTelephonyManager.getEmergencyNumberList();
 
@@ -2432,9 +2390,8 @@
      */
     @Test
     public void testGetEmergencyNumberListForCategories() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
+
         Map<Integer, List<EmergencyNumber>> emergencyNumberList =
                 mTelephonyManager.getEmergencyNumberList(
                         EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_POLICE);
@@ -2463,9 +2420,7 @@
      */
     @Test
     public void testIsEmergencyNumber() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
 
         for (Map.Entry<String, String> entry : EMERGENCY_NUMBERS_FOR_COUNTRIES.entrySet()) {
             if (mTelephonyManager.getNetworkCountryIso().equals(entry.getKey())) {
@@ -2479,9 +2434,7 @@
      */
     @Test
     public void testIsPotentialEmergencyNumber() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
 
         String countryIso = mTelephonyManager.getNetworkCountryIso();
         String potentialEmergencyAddress = "91112345";
@@ -2502,14 +2455,9 @@
      */
     @Test
     public void testSetGetCallComposerStatus() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CALLING));
 
-        boolean hasImsFeature = mPackageManager.hasSystemFeature(
-                PackageManager.FEATURE_TELEPHONY_IMS);
-
-        if (hasImsFeature) {
+        if (hasFeature(PackageManager.FEATURE_TELEPHONY_IMS)) {
             ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
                     tm -> tm.setCallComposerStatus(TelephonyManager.CALL_COMPOSER_STATUS_OFF));
             int status = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
@@ -2541,9 +2489,8 @@
      */
     @Test
     public void testGetRadioAccessFamily() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         long raf = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 (tm) -> tm.getSupportedRadioAccessFamily());
         assertThat(raf).isNotEqualTo(TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN);
@@ -2564,6 +2511,8 @@
      */
     @Test
     public void testPreferredOpportunisticDataSubscription() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
+
         int randomSubId = 1;
         int activeSubscriptionInfoCount = ShellIdentityUtils.invokeMethodWithShellPermissions(
                 mSubscriptionManager, (tm) -> tm.getActiveSubscriptionInfoCount());
@@ -2690,15 +2639,14 @@
      */
     @Test
     public void testUpdateAvailableNetworks() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         int randomSubId = 1;
         int activeSubscriptionInfoCount = ShellIdentityUtils.invokeMethodWithShellPermissions(
                 mSubscriptionManager, (tm) -> tm.getActiveSubscriptionInfoCount());
         boolean isOpportunisticNetworkEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(
                 mTelephonyManager, (tm) -> tm.isOpportunisticNetworkEnabled());
 
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
         if (!isOpportunisticNetworkEnabled) {
             return;
         }
@@ -2755,9 +2703,8 @@
 
     @Test
     public void testSwitchMultiSimConfig() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             mTelephonyManager.switchMultiSimConfig(mTelephonyManager.getActiveModemCount());
             fail("TelephonyManager#switchMultiSimConfig should require the MODIFY_PHONE_STATE"
@@ -2778,9 +2725,8 @@
 
     @Test
     public void testIccOpenLogicalChannelBySlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // just verify no crash
         try {
             ShellIdentityUtils.invokeMethodWithShellPermissions(
@@ -2807,9 +2753,8 @@
 
     @Test
     public void testIccCloseLogicalChannelBySlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // just verify no crash
         try {
             ShellIdentityUtils.invokeMethodWithShellPermissions(
@@ -2849,9 +2794,8 @@
 
     @Test
     public void testIccTransmitApduLogicalChannelBySlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         int slotIndex = getValidSlotIndexAndPort().getKey();
         String result = ShellIdentityUtils.invokeMethodWithShellPermissions(
                 mTelephonyManager, (tm) -> tm.iccTransmitApduLogicalChannelBySlot(
@@ -2893,9 +2837,8 @@
     }
     @Test
     public void testIccTransmitApduBasicChannelBySlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // just verify no crash
         int slotIndex = getValidSlotIndexAndPort().getKey();
         try {
@@ -2940,9 +2883,8 @@
 
     @Test
     public void testIsIccLockEnabled() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // verify SecurityException
         try {
             mTelephonyManager.isIccLockEnabled();
@@ -2962,9 +2904,8 @@
 
     @Test
     public void testIsDataEnabledForApn() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
+
         // verify SecurityException
         try {
             mTelephonyManager.isDataEnabledForApn(ApnSetting.TYPE_MMS);
@@ -2984,9 +2925,8 @@
 
     @Test
     public void testIsTetheringApnRequired() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
+
         // verify SecurityException
         try {
             mTelephonyManager.isTetheringApnRequired();
@@ -3007,9 +2947,8 @@
 
     @Test
     public void testGetCarrierInfoForImsiEncryption() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // test without permission: verify SecurityException
         try {
             mTelephonyManager.getCarrierInfoForImsiEncryption(TelephonyManager.KEY_TYPE_EPDG);
@@ -3100,9 +3039,8 @@
 
     @Test
     public void testResetCarrierKeysForImsiEncryption() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         // test without permission: verify SecurityException
         try {
             mTelephonyManager.resetCarrierKeysForImsiEncryption();
@@ -3122,9 +3060,8 @@
 
     @Test
     public void testIsInEmergencySmsMode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING));
+
         // test without permission: verify SecurityException
         try {
             mTelephonyManager.isInEmergencySmsMode();
@@ -3144,9 +3081,7 @@
 
     @Test
     public void testGetSubscriptionId() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
 
         TelephonyManager tm = mTelephonyManager.createForSubscriptionId(1);
         int subId = tm.getSubscriptionId();
@@ -3155,9 +3090,7 @@
 
     @Test
     public void testSetAllowedNetworkTypes() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // test without permission: verify SecurityException
         long allowedNetworkTypes = TelephonyManager.NETWORK_TYPE_BITMASK_NR;
@@ -3187,9 +3120,7 @@
 
     @Test
     public void testDisAllowedNetworkTypes() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         long allowedNetworkTypes = -1 & (~TelephonyManager.NETWORK_TYPE_BITMASK_NR);
         long networkTypeBitmask = TelephonyManager.NETWORK_TYPE_BITMASK_NR
@@ -3230,9 +3161,7 @@
 
     @Test
     public void testSetAllowedNetworkTypesForReason() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // test without permission: verify SecurityException
         long allowedNetworkTypes = TelephonyManager.NETWORK_TYPE_BITMASK_NR;
@@ -3267,9 +3196,7 @@
 
     @Test
     public void testSetAllowedNetworkTypesForReason_moreReason() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // test without permission: verify SecurityException
         long allowedNetworkTypes1 = TelephonyManager.NETWORK_TYPE_BITMASK_NR
@@ -3340,9 +3267,7 @@
 
     @Test
     public void testIsApplicationOnUicc() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
 
         // Expect a security exception without permission.
         try {
@@ -3366,10 +3291,6 @@
 
     @Test
     public void testRequestModemActivityInfo() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.MODIFY_PHONE_STATE");
         try {
@@ -3409,10 +3330,6 @@
 
     @Test
     public void testGetSupportedModemCount() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         int supportedModemCount = mTelephonyManager.getSupportedModemCount();
         int activeModemCount = mTelephonyManager.getActiveModemCount();
         assertTrue(activeModemCount >= 0);
@@ -3452,10 +3369,6 @@
 
     @Test
     public void testIsModemEnabledForSlot() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
         int activeModemCount = mTelephonyManager.getActiveModemCount();
         for (int i = 0; i < activeModemCount; i++) {
             // Call isModemEnabledForSlot for each slot and verify no crash.
@@ -3465,12 +3378,8 @@
 
     @Test
     public void testOpportunisticNetworkState() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-        if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS)
+                && !mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH));
 
         boolean isEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 tm -> tm.isOpportunisticNetworkEnabled());
@@ -3488,9 +3397,8 @@
 
     @Test
     public void testGetSimApplicationState() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         int simApplicationState = mTelephonyManager.getSimApplicationState();
         assertTrue(Arrays.asList(TelephonyManager.SIM_STATE_UNKNOWN,
                 TelephonyManager.SIM_STATE_PIN_REQUIRED,
@@ -3516,9 +3424,8 @@
 
     @Test
     public void testGetSimCardState() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         int simCardState = mTelephonyManager.getSimCardState();
         assertTrue(Arrays.asList(TelephonyManager.SIM_STATE_UNKNOWN,
                 TelephonyManager.SIM_STATE_ABSENT,
@@ -3528,9 +3435,8 @@
     }
     @Test
     public void getSimCardStateTest() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.READ_PRIVILEGED_PHONE_STATE");
         List<UiccCardInfo> cardsInfo = mTelephonyManager.getUiccCardsInfo();
@@ -3556,9 +3462,7 @@
 
     @Test
     public void testThermalDataEnable() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         // Perform this test on default data subscription.
         mTelephonyManager = getContext().getSystemService(TelephonyManager.class)
@@ -3594,9 +3498,7 @@
 
     @Test
     public void testPolicyDataEnable() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         // Perform this test on default data subscription.
         mTelephonyManager = getContext().getSystemService(TelephonyManager.class)
@@ -3632,9 +3534,7 @@
 
     @Test
     public void testCarrierDataEnable() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         // Perform this test on default data subscription.
         mTelephonyManager = getContext().getSystemService(TelephonyManager.class)
@@ -3671,9 +3571,7 @@
 
     @Test
     public void testUserDataEnable() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
                 mTelephonyManager,
@@ -3707,9 +3605,7 @@
 
     @Test
     public void testDataDuringVoiceCallPolicy() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         ShellIdentityUtils.ShellPermissionMethodHelper<Boolean, TelephonyManager> getPolicyHelper =
                 (tm) -> tm.isMobileDataPolicyEnabled(
@@ -3739,9 +3635,7 @@
 
     @Test
     public void testAlwaysAllowMmsDataPolicy() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_DATA));
 
         ShellIdentityUtils.ShellPermissionMethodHelper<Boolean, TelephonyManager> getPolicyHelper =
                 (tm) -> tm.isMobileDataPolicyEnabled(
@@ -3771,6 +3665,8 @@
 
     @Test
     public void testGetCdmaEnhancedRoamingIndicatorDisplayNumber() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CDMA));
+
         int index = mTelephonyManager.getCdmaEnhancedRoamingIndicatorDisplayNumber();
         int phoneType = mTelephonyManager.getPhoneType();
         if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
@@ -3807,9 +3703,7 @@
 
     @Test
     public void testNrDualConnectivityEnable() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         if (!ShellIdentityUtils.invokeMethodWithShellPermissions(
                 mTelephonyManager, (tm) -> tm.isRadioInterfaceCapabilitySupported(
@@ -3853,10 +3747,8 @@
 
     @Test
     public void testCdmaRoamingMode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CDMA)
+                && mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA);
 
         // Save state
         int cdmaRoamingMode = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
@@ -3880,10 +3772,8 @@
 
     @Test
     public void testCdmaSubscriptionMode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                || mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_CDMA)
+                && mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA);
 
         // Save state
         int cdmaSubscriptionMode = ShellIdentityUtils.invokeMethodWithShellPermissions(
@@ -3907,9 +3797,8 @@
 
     @Test
     public void testPinResult() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         final String empty_pin = ""; // For getting current remaining pin attempt.
         final String pin = "fake_pin";
         final String puk = "fake_puk";
@@ -3957,10 +3846,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_nullRequest() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify NPE throws if set request with null object
         try {
@@ -3972,10 +3858,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_noPermission() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         final SignalStrengthUpdateRequest normalRequest =
                 new SignalStrengthUpdateRequest.Builder()
@@ -4001,10 +3884,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_systemThresholdReportingRequestedWhileIdle() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify system privileged app with permission LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH can
         // set systemThresholdReportingRequestedWhileIdle to true with empty thresholdInfos
@@ -4019,10 +3899,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_hysteresisDbSet() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify SE throws for app when set hysteresisDb in the SignalThresholdInfo
         SignalStrengthUpdateRequest requestWithHysteresisDbSet =
@@ -4049,10 +3926,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_hysteresisMsSet() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify SE throws for app when set hysteresisMs in the SignalThresholdInfo
         SignalStrengthUpdateRequest requestWithHysteresisMsSet =
@@ -4079,10 +3953,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_isEnabledSet() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify SE throws for app when set isEnabled in the SignalThresholdInfo
         SignalStrengthUpdateRequest requestWithThresholdIsEnabledSet =
@@ -4109,10 +3980,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_tooShortThresholds() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // verify SE throws if app set too short thresholds
         SignalStrengthUpdateRequest requestWithTooShortThresholds =
@@ -4137,10 +4005,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_tooLongThresholds() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // verify SE throws if app set too long thresholds
         SignalStrengthUpdateRequest requestWithTooLongThresholds =
@@ -4166,10 +4031,7 @@
 
     @Test
     public void testSetSignalStrengthUpdateRequest_duplicatedRequest() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         final SignalStrengthUpdateRequest normalRequest =
                 new SignalStrengthUpdateRequest.Builder()
@@ -4201,10 +4063,7 @@
 
     @Test
     public void testClearSignalStrengthUpdateRequest_nullRequest() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // Verify NPE should throw if clear request with null object
         try {
@@ -4216,10 +4075,7 @@
 
     @Test
     public void testClearSignalStrengthUpdateRequest_noPermission() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         final SignalStrengthUpdateRequest normalRequest =
                 new SignalStrengthUpdateRequest.Builder()
@@ -4245,10 +4101,7 @@
 
     @Test
     public void testClearSignalStrengthUpdateRequest_clearWithNoSet() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         SignalStrengthUpdateRequest requestNeverSetBefore = new SignalStrengthUpdateRequest
                 .Builder()
@@ -4267,9 +4120,7 @@
 
     @Test
     public void testSendThermalMitigationRequest() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         StringBuilder cmdBuilder = new StringBuilder();
         cmdBuilder.append(THERMAL_MITIGATION_COMMAND_BASE).append(ALLOW_PACKAGE_SUBCOMMAND)
@@ -4387,7 +4238,7 @@
 
     @Test
     public void testIsRadioInterfaceCapabilitySupported() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         assertFalse(mTelephonyManager.isRadioInterfaceCapabilitySupported("empty"));
         assertFalse(mTelephonyManager.isRadioInterfaceCapabilitySupported(null));
@@ -4396,7 +4247,7 @@
 
     @Test
     public void testGetAllCellInfo() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
 
         // For IRadio <1.5, just verify that calling the method doesn't throw an error.
         if (mRadioVersion < RADIO_HAL_VERSION_1_5) {
@@ -4641,7 +4492,7 @@
      * @return whether to proceed the test
      */
     private boolean supportSetFplmn() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+        if (!hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)) {
             return false;
         }
         return mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM;
@@ -4688,12 +4539,6 @@
 
     @Test
     public void testRegisterTelephonyCallbackWithNonLooper() throws Throwable {
-        if (!InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires PackageManager.FEATURE_TELEPHONY");
-            return;
-        }
-
         mMockSignalStrengthsTelephonyCallback = new MockSignalStrengthsTelephonyCallback();
 
         // Test register, generates an mOnSignalStrengthsChanged event
@@ -4734,12 +4579,6 @@
 
     @Test
     public void testRegisterTelephonyCallback() throws Throwable {
-        if (!InstrumentationRegistry.getContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            Log.d(TAG, "Skipping test that requires PackageManager.FEATURE_TELEPHONY");
-            return;
-        }
-
         if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
             // TODO: temp workaround, need to adjust test to for CDMA
             return;
@@ -4830,9 +4669,8 @@
      */
     @Test
     public void testGetNetworkSlicingConfiguration() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS));
+
         CompletableFuture<NetworkSlicingConfig> resultFuture = new CompletableFuture<>();
         ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
                 (tm) -> tm.getNetworkSlicingConfiguration(mSimpleExecutor, resultFuture::complete));
@@ -4840,6 +4678,8 @@
 
     @Test
     public void testCheckCarrierPrivilegesForPackageEnforcesReadPrivilege() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.READ_PRIVILEGED_PHONE_STATE");
@@ -4855,7 +4695,8 @@
 
     @Test
     public void testCheckCarrierPrivilegesForPackageThrowsExceptionWithoutReadPrivilege() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             mTelephonyManager.checkCarrierPrivilegesForPackage(mSelfPackageName);
             fail("TelephonyManager#checkCarrierPrivilegesForPackage must be protected "
@@ -4867,6 +4708,8 @@
 
     @Test
     public void testCheckCarrierPrivilegesForPackageAnyPhone() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             mTelephonyManager.checkCarrierPrivilegesForPackageAnyPhone(mSelfPackageName);
         } catch (SecurityException e) {
@@ -4877,6 +4720,8 @@
 
     @Test
     public void testGetCarrierPackageNamesForIntentAndPhoneEnforcesReadPrivilege() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.READ_PRIVILEGED_PHONE_STATE");
@@ -4894,7 +4739,8 @@
 
     @Test
     public void testGetCarrierPackageNamesForIntentAndPhoneThrowsExceptionWithoutReadPrivilege() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             Intent intent = new Intent();
             int phoneId = 1;
@@ -4911,6 +4757,8 @@
 
     @Test
     public void testGetPackagesWithCarrierPrivilegesEnforcesReadPrivilege() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.READ_PRIVILEGED_PHONE_STATE");
@@ -4926,7 +4774,8 @@
 
     @Test
     public void testGetPackagesWithCarrierPrivilegesThrowsExceptionWithoutReadPrivilege() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             mTelephonyManager.getPackagesWithCarrierPrivileges();
             fail("TelephonyManager#getPackagesWithCarrierPrivileges must be protected "
@@ -4938,7 +4787,8 @@
 
     @Test
     public void testSimSlotMapping() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.MODIFY_PHONE_STATE");
         // passing slotMapping combination
@@ -5000,6 +4850,8 @@
 
     @Test
     public void getUiccSlotInfoTest() {
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         UiccSlotInfo[] slotInfos = mTelephonyManager.getUiccSlotsInfo();
 
         if (slotInfos == null) {
@@ -5024,7 +4876,8 @@
 
     @Test
     public void getSimSlotMappingTestReadPermission() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         try {
             Collection<UiccSlotMapping> simSlotMapping = mTelephonyManager.getSimSlotMapping();
             fail("Expected SecurityException, no READ_PRIVILEGED_PHONE_STATE permission");
@@ -5034,7 +4887,8 @@
     }
     @Test
     public void getSimSlotMappingTest() {
-        if (!hasCellular()) return;
+        assumeTrue(hasFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION));
+
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity("android.permission.READ_PRIVILEGED_PHONE_STATE");
         try {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/VisualVoicemailServiceTest.java b/tests/tests/telephony/current/src/android/telephony/cts/VisualVoicemailServiceTest.java
index 31ba58f..6c19696 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/VisualVoicemailServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/VisualVoicemailServiceTest.java
@@ -23,6 +23,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
 
 import android.app.Instrumentation;
 import android.content.BroadcastReceiver;
@@ -40,7 +41,6 @@
 import android.os.ParcelFileDescriptor;
 import android.provider.Telephony.Sms;
 import android.provider.Telephony.Sms.Intents;
-import androidx.annotation.Nullable;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
@@ -52,6 +52,12 @@
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.annotation.Nullable;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.InputStream;
@@ -66,10 +72,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
 public class VisualVoicemailServiceTest {
 
     private static final String TAG = "VvmServiceTest";
@@ -96,20 +98,20 @@
     @Before
     public void setUp() throws Exception {
         mContext = getInstrumentation().getContext();
-        if (hasTelephony(mContext)) {
-            mPreviousDefaultDialer = getDefaultDialer(getInstrumentation());
-            setDefaultDialer(getInstrumentation(), PACKAGE);
+        assumeTrue(hasFeatureSupported(mContext));
 
-            TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
-            mPhoneAccountHandle = telecomManager
-                    .getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
-            assertNotNull(mPhoneAccountHandle);
-            mPhoneNumber = telecomManager.getLine1Number(mPhoneAccountHandle);
-            assertNotNull(mPhoneNumber, "Tests require a line1 number for the active SIM.");
+        mPreviousDefaultDialer = getDefaultDialer(getInstrumentation());
+        setDefaultDialer(getInstrumentation(), PACKAGE);
 
-            mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
-                    .createForPhoneAccountHandle(mPhoneAccountHandle);
-        }
+        TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
+        mPhoneAccountHandle = telecomManager
+                .getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
+        assertNotNull(mPhoneAccountHandle);
+        mPhoneNumber = telecomManager.getLine1Number(mPhoneAccountHandle);
+        assertNotNull(mPhoneNumber, "Tests require a line1 number for the active SIM.");
+
+        mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
+                .createForPhoneAccountHandle(mPhoneAccountHandle);
 
         PackageManager packageManager = mContext.getPackageManager();
         packageManager.setComponentEnabledSetting(
@@ -122,7 +124,7 @@
 
     @After
     public void tearDown() throws Exception {
-        if (hasTelephony(mContext)) {
+        if (hasFeatureSupported(mContext)) {
             if (!TextUtils.isEmpty(mPreviousDefaultDialer)) {
                 setDefaultDialer(getInstrumentation(), mPreviousDefaultDialer);
             }
@@ -135,11 +137,6 @@
 
     @Test
     public void testPermissionlessService_ignored() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
-
         PackageManager packageManager = mContext.getPackageManager();
         packageManager.setComponentEnabledSetting(
                 new ComponentName(mContext, MockVisualVoicemailService.class),
@@ -184,10 +181,6 @@
 
     @Test
     public void testFilter() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSms result = getSmsFromText("//CTSVVM",
                 "//CTSVVM:STATUS:st=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1");
 
@@ -204,10 +197,6 @@
 
     @Test
     public void testFilter_data() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         if (!hasDataSms()) {
             Log.d(TAG, "skipping test that requires data SMS feature");
             return;
@@ -233,10 +222,6 @@
 
     @Test
     public void testFilter_TrailingSemiColon() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSms result = getSmsFromText("//CTSVVM",
                 "//CTSVVM:STATUS:st=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1;");
 
@@ -253,10 +238,6 @@
 
     @Test
     public void testFilter_EmptyPrefix() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSms result = getSmsFromText("//CTSVVM",
                 "//CTSVVM::st=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1");
 
@@ -273,10 +254,6 @@
 
     @Test
     public void testFilter_EmptyField() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSms result = getSmsFromText("//CTSVVM",
                 "//CTSVVM:STATUS:");
         assertTrue(result.getFields().isEmpty());
@@ -284,90 +261,54 @@
 
     @Test
     public void testFilterFail_NotVvm() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "helloworld");
     }
 
     @Test
     public void testFilterFail_PrefixMismatch() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//FOOVVM:STATUS:st=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1");
     }
 
     @Test
     public void testFilterFail_MissingFirstColon() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVMSTATUS:st=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1");
     }
 
     @Test
     public void testFilterFail_MissingSecondColon() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVM:STATUSst=R;rc=0;srv=1;dn=1;ipt=1;spt=0;u=eg@example.com;pw=1");
     }
 
     @Test
     public void testFilterFail_MessageEndAfterClientPrefix() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVM:");
     }
 
     @Test
     public void testFilterFail_MessageEndAfterPrefix() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVM:STATUS");
     }
 
     @Test
     public void testFilterFail_InvalidKeyValuePair() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVM:STATUS:key");
     }
 
     @Test
     public void testFilterFail_InvalidMissingKey() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertVisualVoicemailSmsNotReceived("//CTSVVM",
                 "//CTSVVM:STATUS:=value");
     }
 
     @Test
     public void testFilter_MissingValue() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSms result = getSmsFromText("//CTSVVM",
                 "//CTSVVM:STATUS:key=");
         assertEquals("STATUS", result.getPrefix());
@@ -376,10 +317,6 @@
 
     @Test
     public void testFilter_originatingNumber_match_filtered() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSmsFilterSettings settings = new VisualVoicemailSmsFilterSettings.Builder()
                 .setClientPrefix("//CTSVVM")
                 .setOriginatingNumbers(Arrays.asList(mPhoneNumber))
@@ -390,10 +327,6 @@
 
     @Test
     public void testFilter_originatingNumber_mismatch_notFiltered() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         VisualVoicemailSmsFilterSettings settings = new VisualVoicemailSmsFilterSettings.Builder()
                 .setClientPrefix("//CTSVVM")
                 .setOriginatingNumbers(Arrays.asList("1"))
@@ -404,10 +337,6 @@
 
     @Test
     public void testFilter_port_match() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         if (!hasDataSms()) {
             Log.d(TAG, "skipping test that requires data SMS feature");
             return;
@@ -423,10 +352,6 @@
 
     @Test
     public void testFilter_port_mismatch() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         if (!hasDataSms()) {
             Log.d(TAG, "skipping test that requires data SMS feature");
             return;
@@ -442,10 +367,6 @@
 
     @Test
     public void testFilter_port_anydata() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         if (!hasDataSms()) {
             Log.d(TAG, "skipping test that requires data SMS feature");
             return;
@@ -464,10 +385,6 @@
      */
     @Test
     public void testFilter_port_anydata_notData() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         if (!hasDataSms()) {
             Log.d(TAG, "skipping test that requires data SMS feature");
             return;
@@ -483,10 +400,6 @@
 
     @Test
     public void testGetVisualVoicemailPackageName_isSelf() {
-        if (!hasTelephony(mContext)) {
-            Log.d(TAG, "skipping test that requires telephony feature");
-            return;
-        }
         assertEquals(PACKAGE, mTelephonyManager.getVisualVoicemailPackageName());
     }
 
@@ -704,10 +617,9 @@
         }
     }
 
-    private static boolean hasTelephony(Context context) {
-        final PackageManager packageManager = context.getPackageManager();
-        return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) &&
-                packageManager.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE);
+    private static boolean hasFeatureSupported(Context context) {
+        return context.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_CALLING);
     }
 
     private boolean hasDataSms() {
diff --git a/tests/tests/telephony/current/src/android/telephony/gba/cts/GbaServiceTest.java b/tests/tests/telephony/current/src/android/telephony/gba/cts/GbaServiceTest.java
index 0a16299..985aca9 100644
--- a/tests/tests/telephony/current/src/android/telephony/gba/cts/GbaServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/gba/cts/GbaServiceTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 import android.app.Instrumentation;
 import android.content.pm.PackageManager;
@@ -97,9 +98,7 @@
 
     @Before
     public void setUp() throws Exception {
-        if (!isFeatureSupported()) {
-            return;
-        }
+        assumeTrue(isFeatureSupported());
 
         setService(SERVICE_PACKAGE);
         setReleaseTime(RELEASE_DEFAULT);
@@ -107,20 +106,12 @@
 
     @Test (expected = SecurityException.class)
     public void testPermissions() {
-        if (!isFeatureSupported()) {
-            throw new SecurityException("Feaure is not supported");
-        }
-
         runGbaFailCase(TelephonyManager.GBA_FAILURE_REASON_FEATURE_NOT_SUPPORTED,
                 android.Manifest.permission.READ_PHONE_STATE);
     }
 
     @Test
     public void testAuthSuccess() {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         Random rand = new Random();
 
         for (int i = 0; i < 20; i++) {
@@ -172,10 +163,6 @@
 
     @Test
     public void testGbaNotSupported() throws Exception {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         setService("");
         sConfig.setConfig(true, new byte[16], BTID, TelephonyManager.GBA_FAILURE_REASON_UNKNOWN);
 
@@ -187,10 +174,6 @@
 
     @Test
     public void testAuthFail() {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         for (int r = TelephonyManager.GBA_FAILURE_REASON_UNKNOWN;
                 r <= TelephonyManager.GBA_FAILURE_REASON_SECURITY_PROTOCOL_NOT_SUPPORTED; r++) {
             sConfig.setConfig(false, new byte[16], BTID, r);
@@ -235,10 +218,6 @@
 
     @Test
     public void testServiceReleaseDefault() throws Exception {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         int ss = sConfig.getServiceState();
         boolean isExpected = (ss == TestGbaConfig.STATE_UNKNOWN
                 || ss == TestGbaConfig.STATE_REMOVED
@@ -256,10 +235,6 @@
 
     @Test
     public void testServiceReleaseDuration() throws Exception {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         int ss = sConfig.getServiceState();
         boolean isExpected = (ss == TestGbaConfig.STATE_UNKNOWN
                 || ss == TestGbaConfig.STATE_REMOVED
@@ -281,10 +256,6 @@
 
     @Test
     public void testServiceNoRelease() throws Exception {
-        if (!isFeatureSupported()) {
-            return;
-        }
-
         int ss = sConfig.getServiceState();
         boolean isExpected = (ss == TestGbaConfig.STATE_UNKNOWN
                 || ss == TestGbaConfig.STATE_REMOVED
@@ -325,7 +296,7 @@
 
     private static boolean isFeatureSupported() {
         if (!InstrumentationRegistry.getContext().getPackageManager().hasSystemFeature(
-                PackageManager.FEATURE_TELEPHONY)) {
+                PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)) {
             return false;
         }
 
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
index 82a2f2a..b53d13e 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
@@ -59,18 +59,13 @@
     public static boolean shouldTestImsService() {
         final PackageManager pm = InstrumentationRegistry.getInstrumentation().getContext()
                 .getPackageManager();
-        boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
-        boolean hasIms = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS);
-        return hasTelephony && hasIms;
+        return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS);
     }
 
     public static boolean shouldTestImsSingleRegistration() {
         final PackageManager pm = InstrumentationRegistry.getInstrumentation().getContext()
                 .getPackageManager();
-        boolean hasIms = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS);
-        boolean hasSingleReg = pm.hasSystemFeature(
-                PackageManager.FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION);
-        return hasIms && hasSingleReg;
+        return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION);
     }
 
     public static int getPreferredActiveSubId() {
diff --git a/tests/tests/telephony2/src/android/telephony2/cts/CallStateListenerPermissionTest.java b/tests/tests/telephony2/src/android/telephony2/cts/CallStateListenerPermissionTest.java
index b580930..25cd10c 100644
--- a/tests/tests/telephony2/src/android/telephony2/cts/CallStateListenerPermissionTest.java
+++ b/tests/tests/telephony2/src/android/telephony2/cts/CallStateListenerPermissionTest.java
@@ -24,6 +24,7 @@
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 import android.content.Context;
 import android.telephony.PhoneStateListener;
@@ -63,6 +64,7 @@
     @Before
     public void setUp() throws Exception {
         mContext = InstrumentationRegistry.getContext();
+        assumeTrue(mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY));
     }
 
     /**
@@ -71,10 +73,6 @@
      */
     @Test
     public void testRegisterWithNoCallLogPermission() {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
         TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
         assertNotNull(telephonyManager);
 
@@ -97,10 +95,6 @@
      */
     @Test
     public void testCallStatePermission() throws Exception {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
         TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
         assertNotNull(telephonyManager);
         MyTelephonyCallback callback = new MyTelephonyCallback();
diff --git a/tests/tests/tv/AndroidManifest.xml b/tests/tests/tv/AndroidManifest.xml
index 3a0ab3d..ece6a0f 100644
--- a/tests/tests/tv/AndroidManifest.xml
+++ b/tests/tests/tv/AndroidManifest.xml
@@ -18,6 +18,10 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.tv.cts">
 
+    <permission android:name="android.media.tv.cts.TvInputManagerTest.PERMISSION_GRANTED"/>
+    <permission android:name="android.media.tv.cts.TvInputManagerTest.PERMISSION_UNGRANTED"/>
+    <uses-permission android:name="android.media.tv.cts.TvInputManagerTest.PERMISSION_GRANTED"/>
+
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
     <uses-permission android:name="android.permission.INJECT_EVENTS"/>
 
@@ -90,6 +94,17 @@
                  android:resource="@xml/stub_tv_input_service"/>
         </service>
 
+        <service android:name="android.media.tv.cts.TvInputManagerTest$StubHardwareTvInputService"
+             android:enabled="false"
+             android:permission="android.permission.BIND_TV_INPUT"
+             android:exported="true">
+            <intent-filter>
+                <action android:name="android.media.tv.TvInputService" />
+            </intent-filter>
+            <meta-data android:name="android.media.tv.input"
+                       android:resource="@xml/stub_tv_input_service" />
+        </service>
+
         <service android:name="android.media.tv.cts.TvInputServiceTest$CountingTvInputService"
              android:permission="android.permission.BIND_TV_INPUT"
              android:exported="true">
diff --git a/tests/tests/tv/src/android/media/tv/cts/TvInputManagerTest.java b/tests/tests/tv/src/android/media/tv/cts/TvInputManagerTest.java
index 87b8913..0ea1e38 100644
--- a/tests/tests/tv/src/android/media/tv/cts/TvInputManagerTest.java
+++ b/tests/tests/tv/src/android/media/tv/cts/TvInputManagerTest.java
@@ -20,7 +20,9 @@
 import android.app.Instrumentation;
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.database.Cursor;
 import android.media.AudioManager;
 import android.media.tv.cts.TvViewTest.MockCallback;
@@ -36,8 +38,10 @@
 import android.media.tv.TvStreamConfig;
 import android.media.tv.TvView;
 import android.net.Uri;
+import android.os.Binder;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.test.ActivityInstrumentationTestCase2;
 import android.tv.cts.R;
 
@@ -47,8 +51,10 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.concurrent.Executor;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Executor;
 
 import org.xmlpull.v1.XmlPullParserException;
 
@@ -59,12 +65,26 @@
     /** The maximum time to wait for an operation. */
     private static final long TIME_OUT_MS = 15000L;
 
+    private static final int DUMMY_DEVICE_ID = Integer.MAX_VALUE;
     private static final String[] VALID_TV_INPUT_SERVICES = {
         StubTunerTvInputService.class.getName()
     };
     private static final String[] INVALID_TV_INPUT_SERVICES = {
         NoMetadataTvInputService.class.getName(), NoPermissionTvInputService.class.getName()
     };
+    private static final String EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION =
+            "android.media.tv.cts.TvInputManagerTest.EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION";
+    private static final String EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED =
+            "android.media.tv.cts.TvInputManagerTest"
+            + ".EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED";
+    private static final String EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED =
+            "android.media.tv.cts.TvInputManagerTest"
+            + ".EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED";
+    private static final String PERMISSION_GRANTED =
+            "android.media.tv.cts.TvInputManagerTest.PERMISSION_GRANTED";
+    private static final String PERMISSION_UNGRANTED =
+            "android.media.tv.cts.TvInputManagerTest.PERMISSION_UNGRANTED";
+
     private static final TvContentRating DUMMY_RATING = TvContentRating.createRating(
             "com.android.tv", "US_TV", "US_TV_PG", "US_TV_D", "US_TV_L");
 
@@ -98,6 +118,64 @@
         return null;
     }
 
+    private static boolean isHardwareDeviceAdded(List<TvInputHardwareInfo> list, int deviceId) {
+        if (list != null) {
+            for (TvInputHardwareInfo info : list) {
+                if (info.getDeviceId() == deviceId) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    private String prepareStubHardwareTvInputService() {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.TV_INPUT_HARDWARE");
+
+        // Use the test api to add an HDMI hardware device
+        mManager.addHardwareDevice(DUMMY_DEVICE_ID);
+        assertTrue(isHardwareDeviceAdded(mManager.getHardwareList(), DUMMY_DEVICE_ID));
+
+        PackageManager pm = getActivity().getPackageManager();
+        ComponentName component =
+                new ComponentName(getActivity(), StubHardwareTvInputService.class);
+        pm.setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+                PackageManager.DONT_KILL_APP);
+        new PollingCheck(TIME_OUT_MS) {
+            @Override
+            protected boolean check() {
+                return null != getInfoForClassName(
+                        mManager.getTvInputList(), StubHardwareTvInputService.class.getName());
+            }
+        }.run();
+
+        TvInputInfo info = getInfoForClassName(
+                mManager.getTvInputList(), StubHardwareTvInputService.class.getName());
+        assertNotNull(info);
+        return info.getId();
+    }
+
+    private void cleanupStubHardwareTvInputService() {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .dropShellPermissionIdentity();
+
+        PackageManager pm = getActivity().getPackageManager();
+        ComponentName component =
+                new ComponentName(getActivity(), StubHardwareTvInputService.class);
+        pm.setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                PackageManager.DONT_KILL_APP);
+        new PollingCheck(TIME_OUT_MS) {
+            @Override
+            protected boolean check() {
+                return null == getInfoForClassName(
+                        mManager.getTvInputList(), StubHardwareTvInputService.class.getName());
+            }
+        }.run();
+
+        mManager.removeHardwareDevice(DUMMY_DEVICE_ID);
+    }
+
     public TvInputManagerTest() {
         super(TvViewStubActivity.class);
     }
@@ -411,7 +489,7 @@
     }
 
     public void testAcquireTvInputHardware() {
-        if (mManager == null) {
+        if (!Utils.hasTvInputFramework(getActivity()) || mManager == null) {
             return;
         }
 
@@ -463,6 +541,64 @@
         }
     }
 
+    public void testGetAvailableExtensionInterfaceNames() {
+        if (!Utils.hasTvInputFramework(getActivity())) {
+            return;
+        }
+
+        try {
+            String inputId = prepareStubHardwareTvInputService();
+
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION, null);
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED, PERMISSION_GRANTED);
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED, PERMISSION_UNGRANTED);
+
+            List<String> names = mManager.getAvailableExtensionInterfaceNames(inputId);
+            assertTrue(names != null && !names.isEmpty());
+            assertTrue(names.contains(EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION));
+            assertTrue(names.contains(EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED));
+            assertFalse(names.contains(EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED));
+
+            StubHardwareTvInputService.clearAvailableExtensionInterfaces();
+
+            names = mManager.getAvailableExtensionInterfaceNames(inputId);
+            assertTrue(names != null && names.isEmpty());
+        } finally {
+            StubHardwareTvInputService.clearAvailableExtensionInterfaces();
+            cleanupStubHardwareTvInputService();
+        }
+    }
+
+    public void testGetExtensionInterface() {
+        if (!Utils.hasTvInputFramework(getActivity())) {
+            return;
+        }
+
+        try {
+            String inputId = prepareStubHardwareTvInputService();
+
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION, null);
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED, PERMISSION_GRANTED);
+            StubHardwareTvInputService.injectAvailableExtensionInterface(
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED, PERMISSION_UNGRANTED);
+
+            assertNotNull(mManager.getExtensionInterface(inputId,
+                    EXTENSION_INTERFACE_NAME_WITHOUT_PERMISSION));
+            assertNotNull(mManager.getExtensionInterface(inputId,
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_GRANTED));
+            assertNull(mManager.getExtensionInterface(inputId,
+                    EXTENSION_INTERFACE_NAME_WITH_PERMISSION_UNGRANTED));
+        } finally {
+            StubHardwareTvInputService.clearAvailableExtensionInterfaces();
+            cleanupStubHardwareTvInputService();
+        }
+    }
+
     private static class LoggingCallback extends TvInputManager.TvInputCallback {
         private final List<String> mAddedInputs = new ArrayList<>();
         private final List<String> mRemovedInputs = new ArrayList<>();
@@ -519,6 +655,74 @@
         }
     }
 
+    public static class StubHardwareTvInputService extends TvInputService {
+        private static final Map<String, String> sAvailableExtensionInterfaceMap = new HashMap<>();
+
+        private ResolveInfo mResolveInfo = null;
+        private TvInputInfo mTvInputInfo = null;
+
+        public static void clearAvailableExtensionInterfaces() {
+            sAvailableExtensionInterfaceMap.clear();
+        }
+
+        public static void injectAvailableExtensionInterface(String name, String permission) {
+            sAvailableExtensionInterfaceMap.put(name, permission);
+        }
+
+        @Override
+        public void onCreate() {
+            mResolveInfo = getPackageManager().resolveService(
+                    new Intent(SERVICE_INTERFACE).setClass(this, getClass()),
+                    PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
+        }
+
+        @Override
+        public  TvInputInfo onHardwareAdded(TvInputHardwareInfo hardwareInfo) {
+            TvInputInfo info = null;
+            if (hardwareInfo.getDeviceId() == DUMMY_DEVICE_ID) {
+                info = new TvInputInfo.Builder(this, mResolveInfo)
+                        .setTvInputHardwareInfo(hardwareInfo)
+                        .build();
+                mTvInputInfo = info;
+            }
+            return info;
+        }
+
+        @Override
+        public String onHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
+            String inputId = null;
+            if (hardwareInfo.getDeviceId() == DUMMY_DEVICE_ID && mTvInputInfo != null) {
+                inputId = mTvInputInfo.getId();
+                mTvInputInfo = null;
+            }
+            return inputId;
+        }
+
+        @Override
+        public Session onCreateSession(String inputId) {
+            return null;
+        }
+
+        @Override
+        public List<String> getAvailableExtensionInterfaceNames() {
+            return new ArrayList<>(sAvailableExtensionInterfaceMap.keySet());
+        }
+
+        @Override
+        public String getExtensionInterfacePermission(String name) {
+            return sAvailableExtensionInterfaceMap.get(name);
+        }
+
+        @Override
+        public IBinder getExtensionInterface(String name) {
+            if (sAvailableExtensionInterfaceMap.containsKey(name)) {
+                return new Binder();
+            } else {
+                return null;
+            }
+        }
+    }
+
     public class CallbackExecutor implements Executor {
         @Override
         public void execute(Runnable r) {
diff --git a/tests/tests/tv/src/android/media/tv/tuner/cts/SharedFilterTestService.java b/tests/tests/tv/src/android/media/tv/tuner/cts/SharedFilterTestService.java
index 68de1df..1ce51e3 100644
--- a/tests/tests/tv/src/android/media/tv/tuner/cts/SharedFilterTestService.java
+++ b/tests/tests/tv/src/android/media/tv/tuner/cts/SharedFilterTestService.java
@@ -19,18 +19,17 @@
 import android.app.Service;
 import android.content.Context;
 import android.content.Intent;
-import android.content.IntentFilter;
 import android.media.tv.tuner.Tuner;
 import android.media.tv.tuner.cts.ISharedFilterTestServer;
 import android.media.tv.tuner.filter.Filter;
 import android.media.tv.tuner.filter.FilterCallback;
 import android.media.tv.tuner.filter.FilterEvent;
-import android.media.tv.tuner.filter.Settings;
 import android.media.tv.tuner.filter.SharedFilter;
 import android.media.tv.tuner.filter.SharedFilterCallback;
 import android.media.tv.tuner.frontend.FrontendInfo;
 import android.os.IBinder;
 import android.util.Log;
+
 import java.util.List;
 import java.util.concurrent.Executor;
 
@@ -58,7 +57,7 @@
     private class SharedFilterTestServer extends ISharedFilterTestServer.Stub {
         @Override
         public String acquireSharedFilterToken() {
-            mFilter = TunerTest.createFilterForSharedFilterTest(
+            mFilter = TunerTest.createTsSectionFilter(
                     mTuner, getExecutor(), getFilterCallback());
 
             // Tune a frontend before start the filter
diff --git a/tests/tests/tv/src/android/media/tv/tuner/cts/TunerTest.java b/tests/tests/tv/src/android/media/tv/tuner/cts/TunerTest.java
index 2fddf7a..e97fd35 100644
--- a/tests/tests/tv/src/android/media/tv/tuner/cts/TunerTest.java
+++ b/tests/tests/tv/src/android/media/tv/tuner/cts/TunerTest.java
@@ -20,7 +20,9 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import android.content.ComponentName;
 import android.content.Context;
@@ -117,6 +119,8 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.time.Duration;
+import java.time.Instant;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
@@ -214,6 +218,38 @@
     }
 
     @Test
+    public void testFrontendHardwareInfo() throws Exception {
+        String hwInfo = null;
+        try {
+            hwInfo = mTuner.getCurrentFrontendHardwardInfo();
+            if (TunerVersionChecker.isHigherOrEqualVersionTo(
+                    TunerVersionChecker.TUNER_VERSION_2_0)) {
+                fail("Get Frontend hardware info should throw IllegalStateException.");
+            } else {
+                assertNull(hwInfo);
+            }
+        } catch (IllegalStateException e) {
+            // pass
+        }
+
+        List<Integer> ids = mTuner.getFrontendIds();
+        if (ids == null) return;
+        assertFalse(ids.isEmpty());
+
+        FrontendInfo info = mTuner.getFrontendInfoById(ids.get(0));
+        int res = mTuner.tune(createFrontendSettings(info));
+        hwInfo = mTuner.getCurrentFrontendHardwardInfo();
+        if (TunerVersionChecker.isHigherOrEqualVersionTo(TunerVersionChecker.TUNER_VERSION_2_0)) {
+            assertNotNull(hwInfo);
+            assertFalse(hwInfo.isEmpty());
+        } else {
+            assertNull(hwInfo);
+        }
+        res = mTuner.cancelTuning();
+        assertEquals(Tuner.RESULT_SUCCESS, res);
+    }
+
+    @Test
     public void testTuning() throws Exception {
         List<Integer> ids = mTuner.getFrontendIds();
         if (ids == null) return;
@@ -424,6 +460,9 @@
                     case FrontendStatus.FRONTEND_STATUS_TYPE_STREAM_IDS:
                         status.getStreamIds();
                         break;
+                    case FrontendStatus.FRONTEND_STATUS_TYPE_DVBT_CELL_IDS:
+                        status.getDvbtCellIds();
+                        break;
                 }
             }
             tuner.close();
@@ -1623,7 +1662,7 @@
 
     @Test
     public void testSharedFilterOneProcess() throws Exception {
-        Filter f = createFilterForSharedFilterTest(mTuner, getExecutor(), getFilterCallback());
+        Filter f = createTsSectionFilter(mTuner, getExecutor(), getFilterCallback());
         assertTrue(f != null);
 
         String token1 = f.acquireSharedFilterToken();
@@ -1741,7 +1780,7 @@
 
     @Test
     public void testSharedFilterTwoProcessesVerifySharedFilter() throws Exception {
-        Filter f = createFilterForSharedFilterTest(mTuner, getExecutor(), getFilterCallback());
+        Filter f = createTsSectionFilter(mTuner, getExecutor(), getFilterCallback());
         assertTrue(f != null);
 
         String token = f.acquireSharedFilterToken();
@@ -1764,7 +1803,39 @@
         f = null;
     }
 
-    static public Filter createFilterForSharedFilterTest(
+    @Test
+    public void testFilterTimeDelay() throws Exception {
+        Filter f = createTsSectionFilter(mTuner, getExecutor(), getFilterCallback());
+
+        int timeDelayInMs = 5000;
+        Instant start = Instant.now();
+        f.delayCallbackUntilTimeMillis(timeDelayInMs);
+
+        // start / stop prevents initial race condition after first setting the time delay.
+        f.start();
+        f.stop();
+
+        mLockLatch = new CountDownLatch(1);
+        f.start();
+        assertTrue(mLockLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
+
+        Instant finish = Instant.now();
+        Duration timeElapsed = Duration.between(start, finish);
+        assertTrue(timeElapsed.toMillis() >= timeDelayInMs);
+
+        f.close();
+        f = null;
+    }
+
+    @Test
+    public void testFilterDataSizeDelay() throws Exception {
+        Filter f = createTsSectionFilter(mTuner, getExecutor(), getFilterCallback());
+        assertEquals(Tuner.RESULT_SUCCESS, f.delayCallbackUntilBufferFilled(5000));
+        f.close();
+    }
+
+
+    public static Filter createTsSectionFilter(
             Tuner tuner, Executor e, FilterCallback cb) {
         Filter f = tuner.openFilter(Filter.TYPE_TS, Filter.SUBTYPE_SECTION, 1000, e, cb);
         Settings settings = SectionSettingsWithTableInfo
@@ -1833,6 +1904,9 @@
                         testRestartEvent(filter, (RestartEvent) e);
                     }
                 }
+                if (mLockLatch != null) {
+                    mLockLatch.countDown();
+                }
             }
             @Override
             public void onFilterStatusChanged(Filter filter, int status) {}
@@ -1889,6 +1963,7 @@
         e.getAudioHandle();
         e.getMpuSequenceNumber();
         e.isPrivateData();
+        e.getScIndexMask();
         AudioDescriptor ad = e.getExtraMetaData();
         if (ad != null) {
             ad.getAdFade();
@@ -2208,6 +2283,13 @@
             }
 
             @Override
+            public void onUnLocked() {
+                if (mLockLatch != null) {
+                    mLockLatch.countDown();
+                }
+            }
+
+            @Override
             public void onScanStopped() {}
 
             @Override
@@ -2272,6 +2354,11 @@
             public void onDvbcAnnexReported(int dvbcAnnext) {
                 ScanCallback.super.onDvbcAnnexReported(dvbcAnnext);
             }
+
+            @Override
+            public void onDvbtCellIdsReported(int[] dvbtCellIds) {
+                ScanCallback.super.onDvbtCellIdsReported(dvbtCellIds);
+            }
         };
     }
 
diff --git a/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java b/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java
index 9352197..93cb563 100755
--- a/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java
+++ b/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java
@@ -39,6 +39,7 @@
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
 import android.provider.Settings;
+import android.text.TextUtils;
 import android.view.FrameStats;
 import android.view.KeyEvent;
 import android.view.WindowAnimationFrameStats;
@@ -189,7 +190,7 @@
             getInstrumentation().waitForIdleSync();
 
             // Find the application window.
-            final int windowId = findAppWindowId(uiAutomation.getWindows());
+            final int windowId = findAppWindowId(uiAutomation.getWindows(), activity);
             assertTrue(windowId >= 0);
 
             // Clear stats to be with a clean slate.
@@ -251,7 +252,7 @@
             getInstrumentation().waitForIdleSync();
 
             // Find the application window.
-            final int windowId = findAppWindowId(uiAutomation.getWindows());
+            final int windowId = findAppWindowId(uiAutomation.getWindows(), activity);
             assertTrue(windowId >= 0);
 
             // Clear stats to be with a clean slate.
@@ -653,11 +654,13 @@
         waitForAccessibilityServiceToStart();
     }
 
-    private int findAppWindowId(List<AccessibilityWindowInfo> windows) {
+    private int findAppWindowId(List<AccessibilityWindowInfo> windows, Activity activity) {
+        final CharSequence activityTitle = getActivityTitle(getInstrumentation(), activity);
         final int windowCount = windows.size();
         for (int i = 0; i < windowCount; i++) {
             AccessibilityWindowInfo window = windows.get(i);
-            if (window.getType() == AccessibilityWindowInfo.TYPE_APPLICATION) {
+            if (window.getType() == AccessibilityWindowInfo.TYPE_APPLICATION
+                    && TextUtils.equals(window.getTitle(), activityTitle)) {
                 return window.getId();
             }
         }
@@ -667,4 +670,11 @@
     private Instrumentation getInstrumentation() {
         return InstrumentationRegistry.getInstrumentation();
     }
+
+    private static CharSequence getActivityTitle(
+            Instrumentation instrumentation, Activity activity) {
+        final StringBuilder titleBuilder = new StringBuilder();
+        instrumentation.runOnMainSync(() -> titleBuilder.append(activity.getTitle()));
+        return titleBuilder;
+    }
 }
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/bitmapverifiers/AntiAliasingVerifier.java b/tests/tests/uirendering/src/android/uirendering/cts/bitmapverifiers/AntiAliasingVerifier.java
new file mode 100644
index 0000000..c05a3ce
--- /dev/null
+++ b/tests/tests/uirendering/src/android/uirendering/cts/bitmapverifiers/AntiAliasingVerifier.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 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.uirendering.cts.bitmapverifiers;
+
+import android.graphics.Rect;
+import android.uirendering.cts.util.CompareUtils;
+
+/**
+ * Tests to see if there is rectangle of a given color, anti-aliased. It checks this by
+ * verifying that a nonzero number of pixels in the area lie strictly between the inner
+ * and outer colors (eg, they are a blend of the two). To verify that a rectangle is
+ * correctly rendered overall, create a RegionVerifier with one Rect to cover the inner
+ * region and another to cover the border region.
+ *
+ * Note that AA is tested by matching the final color against a blend of the inner/outer
+ * colors. To ensure correctness in this test, callers should simplify the test to include
+ * simple colors, eg, Black/Blue and no use of White (which includes colors in all channels).
+ */
+public class AntiAliasingVerifier extends PerPixelBitmapVerifier {
+    private int mOuterColor;
+    private int mInnerColor;
+    private Rect mBorderRect;
+    private int mVerifiedAAPixels = 0;
+
+    public AntiAliasingVerifier(int outerColor, int innerColor, Rect borderRect) {
+        // Zero tolerance since we use failures as signal to test for AA pixels
+        this(outerColor, innerColor, borderRect, 0);
+    }
+
+    public AntiAliasingVerifier(int outerColor, int innerColor, Rect borderRect, int tolerance) {
+        super(tolerance);
+        mOuterColor = outerColor;
+        mInnerColor = innerColor;
+        mBorderRect = borderRect;
+    }
+
+    @Override
+    protected int getExpectedColor(int x, int y) {
+        return mBorderRect.contains(x, y) ? mInnerColor : mOuterColor;
+    }
+
+    @Override
+    public boolean verify(int[] bitmap, int offset, int stride, int width, int height) {
+        boolean result = super.verify(bitmap, offset, stride, width, height);
+        // At a minimum, all but maybe the two end pixels on the left should be AA
+        result &= (mVerifiedAAPixels > (mBorderRect.height() - 2));
+        return result;
+    }
+
+    protected boolean verifyPixel(int x, int y, int observedColor) {
+        boolean result = super.verifyPixel(x, y, observedColor);
+        if (!result) {
+            result = CompareUtils.verifyPixelBetweenColors(observedColor, mOuterColor, mInnerColor);
+            if (result) {
+                ++mVerifiedAAPixels;
+            }
+        }
+        return result;
+    }
+}
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AImageDecoderTest.kt b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AImageDecoderTest.kt
index b007698..84f0803 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AImageDecoderTest.kt
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AImageDecoderTest.kt
@@ -32,6 +32,8 @@
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier
 import android.uirendering.cts.bitmapverifiers.RectVerifier
 import android.uirendering.cts.bitmapverifiers.RegionVerifier
+import android.uirendering.cts.differencevisualizers.PassFailVisualizer
+import android.uirendering.cts.util.BitmapDumper
 import junitparams.JUnitParamsRunner
 import junitparams.Parameters
 import org.junit.Test
@@ -53,6 +55,8 @@
     private val ANDROID_IMAGE_DECODER_FINISHED = -10
     private val ANDROID_IMAGE_DECODER_INVALID_STATE = -11
 
+    private val DEBUG_CAPTURE_IMAGES = false
+
     private fun getAssets(): AssetManager {
         return InstrumentationRegistry.getTargetContext().getAssets()
     }
@@ -144,6 +148,7 @@
      * @param mssimThreshold The minimum MSSIM value to accept as similar. Some
      *                       images do not match exactly, but they've been
      *                       manually verified to look the same.
+     * @param testName Optional name of the calling test for BitmapDumper.
      */
     private fun decodeAndCropFrames(
         image: String,
@@ -151,7 +156,8 @@
         numFrames: Int,
         scaleFactor: Float,
         crop: Crop,
-        mssimThreshold: Double
+        mssimThreshold: Double,
+        testName: String = ""
     ) {
         val decodeAndCropper = DecodeAndCropper(image, scaleFactor, crop)
         var expectedBm = decodeAndCropper.bitmap
@@ -176,7 +182,13 @@
         while (true) {
             nDecode(decoder, testBm, ANDROID_IMAGE_DECODER_SUCCESS)
             val verifier = GoldenImageVerifier(expectedBm, MSSIMComparer(mssimThreshold))
-            assertTrue(verifier.verify(testBm), "$image has mismatch in frame $i")
+            if (!verifier.verify(testBm)) {
+                if (DEBUG_CAPTURE_IMAGES) {
+                    BitmapDumper.dumpBitmaps(expectedBm, testBm, "$testName(${image}_$i)",
+                            "AImageDecoderTest", PassFailVisualizer());
+                }
+                fail("$image has mismatch in frame $i")
+            }
             expectedBm.recycle()
 
             i++
@@ -216,7 +228,11 @@
     @Test
     @Parameters(method = "animationsAndFrames")
     fun testDecodeFramesScaleDown(image: String, frameName: String, numFrames: Int) {
-        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.None, .749)
+        // Perceptually, this image looks reasonable, but the MSSIM is low enough to be
+        // meaningless. It has been manually verified.
+        if (image == "alphabetAnim.gif") return
+        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.None, .749,
+                "testDecodeFramesScaleDown")
     }
 
     @Test
@@ -240,7 +256,11 @@
     @Test
     @Parameters(method = "animationsAndFrames")
     fun testDecodeFramesAndCropTopScaleDown(image: String, frameName: String, numFrames: Int) {
-        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.Top, .749)
+        // Perceptually, this image looks reasonable, but the MSSIM is low enough to be
+        // meaningless. It has been manually verified.
+        if (image == "alphabetAnim.gif") return
+        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.Top, .749,
+                "testDecodeFramesAndCropTopScaleDown")
     }
 
     @Test
@@ -264,7 +284,11 @@
     @Test
     @Parameters(method = "animationsAndFrames")
     fun testDecodeFramesAndCropLeftScaleDown(image: String, frameName: String, numFrames: Int) {
-        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.Left, .596)
+        // Perceptually, this image looks reasonable, but the MSSIM is low enough to be
+        // meaningless. It has been manually verified.
+        if (image == "alphabetAnim.gif") return
+        decodeAndCropFrames(image, frameName, numFrames, .5f, Crop.Left, .596,
+                "testDecodeFramesAndCropLeftScaleDown")
     }
 
     @Test
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
index 5defe4b..7fa1441 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
@@ -1,14 +1,16 @@
 package android.uirendering.cts.testclasses;
 
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import android.graphics.Color;
 import android.graphics.Outline;
 import android.graphics.Path;
 import android.graphics.Rect;
 import android.uirendering.cts.R;
+import android.uirendering.cts.bitmapverifiers.AntiAliasingVerifier;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
+import android.uirendering.cts.bitmapverifiers.RegionVerifier;
 import android.uirendering.cts.testclasses.view.UnclippedBlueView;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.ViewInitializer;
@@ -35,7 +37,12 @@
     static final Rect BOUNDS_RECT = new Rect(0, 0, 80, 80);
     static final Rect PADDED_RECT = new Rect(15, 16, 63, 62);
     static final Rect OUTLINE_RECT = new Rect(1, 2, 78, 79);
+    static final Rect ANTI_ALIAS_OUTLINE_RECT = new Rect(20, 10, 80, 80);
     static final Rect CLIP_BOUNDS_RECT = new Rect(10, 20, 50, 60);
+    static final Rect CONCAVE_OUTLINE_RECT1 = new Rect(0, 0, 10, 90);
+    static final Rect CONCAVE_TEST_RECT1 = new Rect(0, 10, 90, 90);
+    static final Rect CONCAVE_OUTLINE_RECT2 = new Rect(0, 0, 90, 10);
+    static final Rect CONCAVE_TEST_RECT2 = new Rect(10, 0, 90, 90);
 
     static final ViewInitializer BOUNDS_CLIP_INIT =
             rootView -> ((ViewGroup)rootView).setClipChildren(true);
@@ -49,6 +56,7 @@
 
     static final ViewInitializer OUTLINE_CLIP_INIT = rootView -> {
         View child = rootView.findViewById(R.id.child);
+//        ((ViewGroup)(child.getParent())).setBackgroundColor(Color.WHITE);
         child.setOutlineProvider(new ViewOutlineProvider() {
             @Override
             public void getOutline(View view, Outline outline) {
@@ -58,6 +66,48 @@
         child.setClipToOutline(true);
     };
 
+    static final ViewInitializer OUTLINE_CLIP_AA_INIT = rootView -> {
+        View child = rootView.findViewById(R.id.child);
+        ((ViewGroup) (child.getParent())).setBackgroundColor(Color.BLACK);
+        child.setOutlineProvider(new ViewOutlineProvider() {
+            Path mPath = new Path();
+            @Override
+            public void getOutline(View view, Outline outline) {
+                mPath.rewind();
+                // We're using the AA outline rect as a starting point, but shifting one of the
+                // vetices slightly to force AA for this not-quite-rectangle
+                mPath.moveTo(ANTI_ALIAS_OUTLINE_RECT.left, ANTI_ALIAS_OUTLINE_RECT.top);
+                mPath.lineTo(ANTI_ALIAS_OUTLINE_RECT.right, ANTI_ALIAS_OUTLINE_RECT.top);
+                mPath.lineTo(ANTI_ALIAS_OUTLINE_RECT.right, ANTI_ALIAS_OUTLINE_RECT.bottom);
+                mPath.lineTo(ANTI_ALIAS_OUTLINE_RECT.left + 1, ANTI_ALIAS_OUTLINE_RECT.bottom);
+                mPath.close();
+                outline.setPath(mPath);
+            }
+        });
+        child.setClipToOutline(true);
+    };
+
+    static final ViewInitializer CONCAVE_CLIP_INIT = rootView -> {
+        View child = rootView.findViewById(R.id.child);
+        ((ViewGroup) (child.getParent())).setBackgroundColor(Color.BLACK);
+        child.setOutlineProvider(new ViewOutlineProvider() {
+            Path mPath = new Path();
+            @Override
+            public void getOutline(View view, Outline outline) {
+                mPath.rewind();
+                mPath.addRect(CONCAVE_OUTLINE_RECT1.left, CONCAVE_OUTLINE_RECT1.top,
+                        CONCAVE_OUTLINE_RECT1.right, CONCAVE_OUTLINE_RECT1.bottom,
+                        Path.Direction.CW);
+                mPath.addRect(CONCAVE_OUTLINE_RECT2.left, CONCAVE_OUTLINE_RECT2.top,
+                        CONCAVE_OUTLINE_RECT2.right, CONCAVE_OUTLINE_RECT2.bottom,
+                        Path.Direction.CW);
+                outline.setPath(mPath);
+                assertTrue(outline.canClip());
+            }
+        });
+        child.setClipToOutline(true);
+    };
+
     static final ViewInitializer CLIP_BOUNDS_CLIP_INIT =
             view -> view.setClipBounds(CLIP_BOUNDS_RECT);
 
@@ -66,6 +116,18 @@
         return new RectVerifier(Color.WHITE, Color.BLUE, blueBoundsRect, 75);
     }
 
+    static BitmapVerifier makeConcaveClipVerifier() {
+        return new RegionVerifier()
+                .addVerifier(CONCAVE_TEST_RECT1, new RectVerifier(Color.BLACK, Color.BLUE,
+                        CONCAVE_OUTLINE_RECT1, 75))
+                .addVerifier(CONCAVE_TEST_RECT2, new RectVerifier(Color.BLACK, Color.BLUE,
+                        CONCAVE_OUTLINE_RECT2, 75));
+    }
+
+    static BitmapVerifier makeAAClipVerifier(Rect blueBoundsRect) {
+        return new AntiAliasingVerifier(Color.BLACK, Color.BLUE, blueBoundsRect);
+    }
+
     @Test
     public void testSimpleUnclipped() {
         createTest()
@@ -109,10 +171,16 @@
     }
 
     @Test
+    public void testAntiAliasedOutlineClip() {
+        // NOTE: Only HW is supported
+        createTest()
+                .addLayout(R.layout.blue_padded_layout, OUTLINE_CLIP_AA_INIT, true)
+                .runWithVerifier(makeAAClipVerifier(ANTI_ALIAS_OUTLINE_RECT));
+    }
+
+    @Test
     public void testOvalOutlineClip() {
-        // In hw this works because clipping to an arbitrary path (i.e. not a rectangle, round rect
-        // or circle) isn't supported, and is no-op'd.
-        // In sw this works because Outline clipping isn't supported.
+        // As of Android T, Outline clipping is enabled for all shapes.
         createTest()
                 .addLayout(R.layout.blue_padded_layout, view -> {
                     view.setOutlineProvider(new ViewOutlineProvider() {
@@ -123,10 +191,10 @@
                             mPath.addOval(0, 0, view.getWidth(), view.getHeight(),
                                     Path.Direction.CW);
                             outline.setPath(mPath);
-                            assertFalse(outline.canClip());
+                            assertTrue(outline.canClip());
                         }
                     });
-                    view.setClipToOutline(true); // should do nothing
+                    view.setClipToOutline(false); // should do nothing
                 })
                 .runWithVerifier(makeClipVerifier(FULL_RECT));
     }
@@ -137,23 +205,9 @@
         // path, but it does not result in clipping, which is only supported when explicitly calling
         // one of the other setters. (hw no-op's the arbitrary path, and sw doesn't support Outline
         // clipping.)
+        // As of T, path clipping is enabled for all Outline shapes.
         createTest()
-                .addLayout(R.layout.blue_padded_layout, view -> {
-                    view.setOutlineProvider(new ViewOutlineProvider() {
-                        Path mPath = new Path();
-                        @Override
-                        public void getOutline(View view, Outline outline) {
-                            mPath.reset();
-                            mPath.addRect(0, 0, 10, 100, Path.Direction.CW);
-                            mPath.addRect(0, 0, 100, 10, Path.Direction.CW);
-                            assertFalse(mPath.isConvex());
-
-                            outline.setPath(mPath);
-                            assertFalse(outline.canClip());
-                        }
-                    });
-                    view.setClipToOutline(true); // should do nothing
-                })
-                .runWithVerifier(makeClipVerifier(FULL_RECT));
+                .addLayout(R.layout.blue_padded_layout, CONCAVE_CLIP_INIT, true)
+                .runWithVerifier(makeConcaveClipVerifier());
     }
 }
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/util/CompareUtils.java b/tests/tests/uirendering/src/android/uirendering/cts/util/CompareUtils.java
index c80a778..de7d149 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/util/CompareUtils.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/util/CompareUtils.java
@@ -25,4 +25,16 @@
                 && Math.abs(Color.green(color) - average) <= threshold
                 && Math.abs(Color.blue(color) - average) <= threshold;
     }
+
+    /**
+     * @return True if color strictly between inner and outer colors. This verifies that the
+     * color is a mixture of the two, not just one or the other (for anti-aliased pixels).
+     */
+    public static boolean verifyPixelBetweenColors(int color, int expectedOuterColor,
+            int expectedInnerColor) {
+        if (color == expectedInnerColor || color == expectedOuterColor) {
+            return false;
+        }
+        return color == ((color & expectedInnerColor) | (color & expectedOuterColor));
+    }
 }
diff --git a/tests/tests/webkit/Android.bp b/tests/tests/webkit/Android.bp
index 30cb45f..d8175dd 100644
--- a/tests/tests/webkit/Android.bp
+++ b/tests/tests/webkit/Android.bp
@@ -31,7 +31,10 @@
         "ctstestrunner-axt",
         "hamcrest-library",
     ],
-    srcs: ["src/**/*.java"],
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.aidl",
+    ],
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
diff --git a/tests/tests/webkit/src/android/webkit/cts/ITestProcessService.aidl b/tests/tests/webkit/src/android/webkit/cts/ITestProcessService.aidl
new file mode 100644
index 0000000..173c644
--- /dev/null
+++ b/tests/tests/webkit/src/android/webkit/cts/ITestProcessService.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.webkit.cts;
+
+import android.os.Bundle;
+
+interface ITestProcessService {
+    /**
+     * Runs the given test class.
+     *
+     * <p>This is a sync call.
+     *
+     * @param testClassName the name of a test class that extends {@code
+     *     TestProcessClient#TestRunnable}.
+     * @return test result as a bundle. If the test passes, the bundle will be empty. If it fails,
+     *     it will contain the failure exception as a Serializable.
+     */
+    Bundle run(String testClassName);
+
+    /**
+     * Terminates the TestProcessService process.
+     *
+     * <p>This is a sync call.
+     */
+    void exit();
+}
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestProcessClient.java b/tests/tests/webkit/src/android/webkit/cts/TestProcessClient.java
index 418c1cb..0a3946e 100644
--- a/tests/tests/webkit/src/android/webkit/cts/TestProcessClient.java
+++ b/tests/tests/webkit/src/android/webkit/cts/TestProcessClient.java
@@ -20,11 +20,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.DeadObjectException;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
-import android.os.Message;
-import android.os.Messenger;
 import android.os.RemoteException;
 
 import com.android.internal.annotations.GuardedBy;
@@ -32,7 +32,6 @@
 import com.google.common.util.concurrent.SettableFuture;
 
 import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
 
 /**
  * IPC interface to run tests in a freshly spawned service process.
@@ -48,19 +47,15 @@
 class TestProcessClient extends Assert implements AutoCloseable, ServiceConnection {
     private Context mContext;
 
-    static final long REMOTE_TIMEOUT_MS = 5000;
-
     private static final long CONNECT_TIMEOUT_MS = 5000;
 
     private Object mLock = new Object();
-    @GuardedBy("mLock")
-    private Messenger mService;
-    @GuardedBy("mLock")
-    private Integer mLastResult;
-    @GuardedBy("mLock")
-    private Throwable mLastException;
 
-    private final Messenger mReplyHandler = new Messenger(new ReplyHandler(Looper.getMainLooper()));
+    @GuardedBy("mLock")
+    private ITestProcessService mService;
+
+    @GuardedBy("mLock")
+    private boolean mIsConnectionClosed = false;
 
     public static TestProcessClient createProcessA(Context context) throws Throwable {
         return new TestProcessClient(context, TestProcessServiceA.class);
@@ -70,22 +65,18 @@
         return new TestProcessClient(context, TestProcessServiceB.class);
     }
 
-    /**
-     * Subclass this to implement test code to run on the service side.
-     */
-    static abstract class TestRunnable extends Assert {
+    /** Subclass this to implement test code to run on the service side. */
+    abstract static class TestRunnable extends Assert {
         public abstract void run(Context ctx) throws Throwable;
     }
 
-    /**
-     * Subclass this to implement test code that runs on the main looper on the service side.
-     */
-    static abstract class UiThreadTestRunnable extends TestRunnable {
+    /** Subclass this to implement test code that runs on the main looper on the service side. */
+    abstract static class UiThreadTestRunnable extends TestRunnable {
         // A handler for the main thread.
         private static final Handler sMainThreadHandler = new Handler(Looper.getMainLooper());
 
         @Override
-        final public void run(Context ctx) throws Throwable {
+        public final void run(Context ctx) throws Throwable {
             final SettableFuture<Void> exceptionPropagatingFuture = SettableFuture.create();
             sMainThreadHandler.post(new Runnable() {
                 @Override
@@ -106,6 +97,7 @@
 
     static class ProcessFreshChecker extends TestRunnable {
         private static Object sFreshLock = new Object();
+
         @GuardedBy("sFreshLock")
         private static boolean sFreshProcess = true;
 
@@ -118,7 +110,6 @@
                 sFreshProcess = false;
             }
         }
-
     }
 
     private TestProcessClient(Context context, Class service) throws Throwable {
@@ -135,48 +126,35 @@
         }
 
         // Check that we're using an actual fresh process.
-        // 1000ms timeout is plenty since the service is already running.
-        run(ProcessFreshChecker.class, 1000);
+        run(ProcessFreshChecker.class);
     }
 
     public void run(Class runnableClass) throws Throwable {
-        run(runnableClass, REMOTE_TIMEOUT_MS);
-    }
-
-    public void run(Class runnableClass, long timeoutMs) throws Throwable {
-        Message m = Message.obtain(null, TestProcessService.MSG_RUN_TEST);
-        m.replyTo = mReplyHandler;
-        m.getData().putString(TestProcessService.TEST_CLASS_KEY, runnableClass.getName());
-        int result;
-        Throwable exception;
+        Bundle result;
         synchronized (mLock) {
-            mService.send(m);
-            if (mLastResult == null) {
-                mLock.wait(timeoutMs);
-                if (mLastResult == null) {
-                    fail("Timeout waiting for result");
-                }
-            }
-            result = mLastResult;
-            mLastResult = null;
-            exception = mLastException;
-            mLastException = null;
+            result = mService.run(runnableClass.getName());
         }
-        if (result == TestProcessService.REPLY_EXCEPTION) {
+        Throwable exception =
+                (Throwable) result.getSerializable(TestProcessService.REPLY_EXCEPTION_KEY);
+        if (exception != null) {
             throw exception;
-        } else if (result != TestProcessService.REPLY_OK) {
-            fail("Unknown result from service: " + result);
         }
     }
 
     public void close() {
         synchronized (mLock) {
-            if (mService != null) {
-                try {
-                    mService.send(Message.obtain(null, TestProcessService.MSG_EXIT_PROCESS));
-                } catch (RemoteException e) {}
-                mService = null;
-                mContext.unbindService(this);
+            if (mIsConnectionClosed) {
+                return;
+            }
+            mIsConnectionClosed = true;
+            try {
+                if (mService != null) {
+                    mService.exit();
+                    fail("This should result in a DeadObjectException");
+                }
+            } catch (DeadObjectException e) {
+            } catch (RemoteException e) {
+                throw new RuntimeException(e);
             }
         }
     }
@@ -184,7 +162,7 @@
     @Override
     public void onServiceConnected(ComponentName className, IBinder service) {
         synchronized (mLock) {
-            mService = new Messenger(service);
+            mService = ITestProcessService.Stub.asInterface(service);
             mLock.notify();
         }
     }
@@ -194,27 +172,10 @@
         synchronized (mLock) {
             mService = null;
             mContext.unbindService(this);
-            mLastResult = TestProcessService.REPLY_EXCEPTION;
-            mLastException = new AssertionFailedError(
-                    "Service disconnected unexpectedly: " + className);
             mLock.notify();
-        }
-    }
-
-    private class ReplyHandler extends Handler {
-        ReplyHandler(Looper looper) {
-            super(looper);
-        }
-
-        @Override
-        public void handleMessage(Message msg) {
-            synchronized (mLock) {
-                mLastResult = msg.what;
-                if (msg.what == TestProcessService.REPLY_EXCEPTION) {
-                    mLastException = (Throwable) msg.getData().getSerializable(
-                            TestProcessService.REPLY_EXCEPTION_KEY);
-                }
-                mLock.notify();
+            // Service wasn't explicitly disconnected in the close() method.
+            if (!mIsConnectionClosed) {
+                fail("Service disconnected unexpectedly");
             }
         }
     }
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestProcessClientTest.java b/tests/tests/webkit/src/android/webkit/cts/TestProcessClientTest.java
new file mode 100644
index 0000000..f605f64
--- /dev/null
+++ b/tests/tests/webkit/src/android/webkit/cts/TestProcessClientTest.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2021 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.webkit.cts;
+
+import android.content.Context;
+import android.os.Looper;
+import android.test.InstrumentationTestCase;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import java.io.IOException;
+
+/**
+ * Test various scenarios of using {@link TestProcessService} and {@link TestProcessClient}
+ * framework to run tests cases in freshly created test processes.
+ */
+public class TestProcessClientTest extends InstrumentationTestCase {
+
+    static class TestRunningOnUiThread extends TestProcessClient.UiThreadTestRunnable {
+        @Override
+        protected void runOnUiThread(Context ctx) throws Throwable {
+            Assert.assertTrue(
+                    "Test is not running on the main thread",
+                    Looper.getMainLooper().isCurrentThread());
+        }
+    }
+
+    static class TestRunningOnDefaultThread extends TestProcessClient.TestRunnable {
+        private static Looper sLooper;
+
+        @Override
+        public void run(Context ctx) throws Throwable {
+            Assert.assertFalse(
+                    "Default thread should be different from the main thread",
+                    Looper.getMainLooper().isCurrentThread());
+            if (sLooper == null) {
+                sLooper = Looper.myLooper();
+                Assert.assertNotNull("The default thread should have a looper", sLooper);
+            } else {
+                Assert.assertTrue(
+                        "Test cases should run on the same thread", sLooper.isCurrentThread());
+            }
+        }
+    }
+
+    public void testRunDifferentRunnables() throws Throwable {
+        Context context = InstrumentationRegistry.getInstrumentation().getContext();
+        try (TestProcessClient process = TestProcessClient.createProcessA(context)) {
+            process.run(TestRunningOnUiThread.class);
+            process.run(TestRunningOnDefaultThread.class);
+            process.run(TestRunningOnDefaultThread.class);
+        }
+    }
+
+    static class TestNullPointerException extends TestProcessClient.TestRunnable {
+        @Override
+        public void run(Context ctx) throws Throwable {
+            throw new NullPointerException("Test NullPointerException, should be caught");
+        }
+    }
+
+    /**
+     * Test throwing an exception that is handled by the Parcel class: {@link
+     * Parcel#writeException(java.lang.Exception)}.
+     */
+    public void testThrowingNullPointerException() throws Throwable {
+        Context context = InstrumentationRegistry.getInstrumentation().getContext();
+        try (TestProcessClient process = TestProcessClient.createProcessA(context)) {
+            process.run(TestNullPointerException.class);
+            fail("A NullPointerException is expected to be thrown");
+        } catch (NullPointerException e) {
+
+        }
+    }
+
+    static class TestIOException extends TestProcessClient.TestRunnable {
+        @Override
+        public void run(Context ctx) throws Throwable {
+            throw new IOException("Test IOException, should be caught");
+        }
+    }
+
+    /**
+     * Test throwing an exception that is not handled by the Parcel class: {@link
+     * Parcel#writeException(java.lang.Exception)}.
+     */
+    public void testThrowingIOException() throws Throwable {
+        Context context = InstrumentationRegistry.getInstrumentation().getContext();
+        try (TestProcessClient process = TestProcessClient.createProcessA(context)) {
+            process.run(TestIOException.class);
+            fail("An IOException is expected to be thrown");
+        } catch (IOException e) {
+        }
+    }
+
+    static class TestFailedAssertion extends TestProcessClient.TestRunnable {
+        @Override
+        public void run(Context ctx) throws Throwable {
+            fail("This assertion should be caught");
+        }
+    }
+
+    /**
+     * Test that junit assertions failures are propagated as expected.
+     */
+    public void testFailedAssertion() throws Throwable {
+        Context context = InstrumentationRegistry.getInstrumentation().getContext();
+        try (TestProcessClient process = TestProcessClient.createProcessA(context)) {
+            process.run(TestFailedAssertion.class);
+            fail("An AssertionFailedError is expected to be thrown");
+        } catch (AssertionFailedError e) {
+            Assert.assertEquals("This assertion should be caught", e.getMessage());
+        }
+    }
+}
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestProcessService.java b/tests/tests/webkit/src/android/webkit/cts/TestProcessService.java
index 499d18c..f3c80b2 100644
--- a/tests/tests/webkit/src/android/webkit/cts/TestProcessService.java
+++ b/tests/tests/webkit/src/android/webkit/cts/TestProcessService.java
@@ -17,79 +17,53 @@
 package android.webkit.cts;
 
 import android.app.Service;
-import android.content.Context;
 import android.content.Intent;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.IBinder;
-import android.os.Looper;
-import android.os.Message;
-import android.os.Messenger;
-import android.os.RemoteException;
 
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
+import com.google.common.util.concurrent.SettableFuture;
 
 // Subclasses are the ones that get actually used, so make this abstract
 abstract class TestProcessService extends Service {
-    static final int MSG_RUN_TEST = 0;
-    static final int MSG_EXIT_PROCESS = 1;
-    static final String TEST_CLASS_KEY = "class";
-
-    static final int REPLY_OK = 0;
-    static final int REPLY_EXCEPTION = 1;
     static final String REPLY_EXCEPTION_KEY = "exception";
 
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mMessenger.getBinder();
-    }
-
-    final Messenger mMessenger;
+    private final Handler mHandler;
 
     public TestProcessService() {
-        HandlerThread backgroundThread = new HandlerThread("TestThread");
-        backgroundThread.start();
-        mMessenger = new Messenger(new IncomingHandler(backgroundThread.getLooper()));
+        HandlerThread handlerThread = new HandlerThread("TestThread");
+        handlerThread.start();
+        mHandler = new Handler(handlerThread.getLooper());
     }
 
-    private class IncomingHandler extends Handler {
-        IncomingHandler(Looper looper) {
-            super(looper);
+    private final ITestProcessService.Stub mBinder = new ITestProcessService.Stub() {
+        @Override
+        public Bundle run(String testClassName) {
+            final SettableFuture<Bundle> testResultFuture = SettableFuture.create();
+            mHandler.post(() -> {
+                Bundle testResultBundle = new Bundle();
+                try {
+                    Class testClass = Class.forName(testClassName);
+                    TestProcessClient.TestRunnable test =
+                            (TestProcessClient.TestRunnable) testClass.newInstance();
+                    test.run(TestProcessService.this);
+                } catch (Throwable t) {
+                    testResultBundle.putSerializable(REPLY_EXCEPTION_KEY, t);
+                }
+                testResultFuture.set(testResultBundle);
+            });
+            return WebkitUtils.waitForFuture(testResultFuture);
         }
 
         @Override
-        public void handleMessage(Message msg) {
-            if (msg.what == MSG_EXIT_PROCESS) {
-                System.exit(0);
-            }
-
-            try {
-                if (msg.what != MSG_RUN_TEST) {
-                    throw new AssertionFailedError("Unknown service message " + msg.what);
-                }
-
-                String testClassName = msg.getData().getString(TEST_CLASS_KEY);
-                Class testClass = Class.forName(testClassName);
-                TestProcessClient.TestRunnable test =
-                        (TestProcessClient.TestRunnable) testClass.newInstance();
-                test.run(TestProcessService.this);
-            } catch (Throwable t) {
-                try {
-                    Message m = Message.obtain(null, REPLY_EXCEPTION);
-                    m.getData().putSerializable(REPLY_EXCEPTION_KEY, t);
-                    msg.replyTo.send(m);
-                } catch (RemoteException e) {
-                    throw new RuntimeException(e);
-                }
-                return;
-            }
-
-            try {
-                msg.replyTo.send(Message.obtain(null, REPLY_OK));
-            } catch (RemoteException e) {
-                throw new RuntimeException(e);
-            }
+        public void exit() {
+            System.exit(0);
         }
+    };
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return mBinder;
     }
 }
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
index 2c99668..f0d0804 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -2158,6 +2158,10 @@
                     testSoftApConfig.isBridgedModeOpportunisticShutdownEnabled());
             assertEquals(currentConfig.isIeee80211axEnabled(),
                     testSoftApConfig.isIeee80211axEnabled());
+            if (ApiLevelUtil.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
+                assertEquals(currentConfig.getBridgedModeOpportunisticShutdownTimeoutMillis(),
+                        testSoftApConfig.getBridgedModeOpportunisticShutdownTimeoutMillis());
+            }
         }
     }
 
@@ -2382,6 +2386,10 @@
                             callback.getCurrentSoftApCapability()).keyAt(0))
                     .setHiddenSsid(false);
 
+            if (ApiLevelUtil.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
+                softApConfigBuilder.setBridgedModeOpportunisticShutdownTimeoutMillis(30_000);
+            }
+
             // Test SoftApConfiguration set and get
             verifySetGetSoftApConfig(softApConfigBuilder.build());
 
diff --git a/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java b/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
index a8866f2..b488fec 100644
--- a/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
@@ -24,6 +24,7 @@
 import android.net.wifi.cts.WifiBuildCompat;
 import android.net.wifi.rtt.RangingRequest;
 import android.net.wifi.rtt.RangingResult;
+import android.net.wifi.rtt.ResponderConfig;
 import android.net.wifi.rtt.ResponderLocation;
 import android.platform.test.annotations.AppModeFull;
 
@@ -47,7 +48,7 @@
     private static final int NUM_OF_RTT_ITERATIONS = 10;
 
     // Maximum failure rate of RTT measurements (percentage)
-    private static final int MAX_FAILURE_RATE_PERCENT = 10;
+    private static final int MAX_FAILURE_RATE_PERCENT = 20;
 
     // Maximum variation from the average measurement (measures consistency)
     private static final int MAX_VARIATION_FROM_AVERAGE_DISTANCE_MM = 2000;
@@ -55,6 +56,9 @@
     // Maximum failure rate of one-sided RTT measurements (percentage)
     private static final int MAX_NON11MC_FAILURE_RATE_PERCENT = 40;
 
+    // Maximum non-8011mc variation from the average measurement (measures consistency)
+    private static final int MAX_NON11MC_VARIATION_FROM_AVERAGE_DISTANCE_MM = 4000;
+
     // Minimum valid RSSI value
     private static final int MIN_VALID_RSSI = -100;
 
@@ -65,14 +69,14 @@
     private static final int intervalMs = 200;
 
     /**
-     * Test Wi-Fi RTT ranging operation:
+     * Test Wi-Fi RTT ranging operation using ScanResults in request:
      * - Scan for visible APs for the test AP (which is validated to support IEEE 802.11mc)
      * - Perform N (constant) RTT operations
      * - Validate:
      *   - Failure ratio < threshold (constant)
      *   - Result margin < threshold (constant)
      */
-    public void testRangingToTest11mcAp() throws InterruptedException {
+    public void testRangingToTest11mcApUsingScanResult() throws InterruptedException {
         if (!shouldTestWifiRtt(getContext())) {
             return;
         }
@@ -82,10 +86,10 @@
         assertNotNull(
                 "Cannot find any test APs which support RTT / IEEE 802.11mc - please verify that "
                         + "your test setup includes them!", testAp);
-
         // Perform RTT operations
         RangingRequest.Builder builder = new RangingRequest.Builder();
         builder.addAccessPoint(testAp);
+
         if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
             builder.setRttBurstSize(RangingRequest.getMaxRttBurstSize());
             assertTrue(RangingRequest.getDefaultRttBurstSize()
@@ -93,11 +97,124 @@
             assertTrue(RangingRequest.getDefaultRttBurstSize()
                     <= RangingRequest.getMaxRttBurstSize());
         }
+
         RangingRequest request = builder.build();
         if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
             assertEquals(1, request.getRttResponders().size());
         }
+        range11mcApRequest(request, testAp);
+    }
 
+    /**
+     * Test Wi-Fi RTT ranging using ResponderConfig in the single responder RangingRequest API.
+     * - Scan for visible APs for the test AP (which is validated to support IEEE 802.11mc)
+     * - Perform N (constant) RTT operations
+     * - Validate:
+     *   - Failure ratio < threshold (constant)
+     *   - Result margin < threshold (constant)
+     */
+    public void testRangingToTest11mcApUsingResponderConfig() throws InterruptedException {
+        if (!shouldTestWifiRtt(getContext())) {
+            return;
+        }
+
+        // Scan for IEEE 802.11mc supporting APs
+        ScanResult testAp = scanForTest11mcCapableAp(NUM_SCANS_SEARCHING_FOR_IEEE80211MC_AP);
+        assertNotNull(
+                "Cannot find any test APs which support RTT / IEEE 802.11mc - please verify that "
+                        + "your test setup includes them!", testAp);
+        int preamble = ResponderConfig.fromScanResult(testAp).getPreamble();
+
+        // Create a ResponderConfig from the builder API.
+        ResponderConfig.Builder responderBuilder = new ResponderConfig.Builder();
+        ResponderConfig responder = responderBuilder
+                .setMacAddress(MacAddress.fromString(testAp.BSSID))
+                .set80211mcSupported(testAp.is80211mcResponder())
+                .setChannelWidth(testAp.channelWidth)
+                .setFrequencyMhz(testAp.frequency)
+                .setCenterFreq0Mhz(testAp.centerFreq0)
+                .setCenterFreq1Mhz(testAp.centerFreq1)
+                .setPreamble(preamble)
+                .build();
+
+        // Validate ResponderConfig.Builder set method arguments match getter methods.
+        assertTrue(responder.getMacAddress().toString().equalsIgnoreCase(testAp.BSSID)
+                        && responder.is80211mcSupported() == testAp.is80211mcResponder()
+                        && responder.getChannelWidth() == testAp.channelWidth
+                        && responder.getFrequencyMhz() == testAp.frequency
+                        && responder.getCenterFreq0Mhz() == testAp.centerFreq0
+                        && responder.getCenterFreq1Mhz() == testAp.centerFreq1
+                        && responder.getPreamble() == preamble);
+
+        // Perform RTT operations
+        RangingRequest.Builder builder = new RangingRequest.Builder();
+        builder.addResponder(responder);
+
+        if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
+            builder.setRttBurstSize(RangingRequest.getMaxRttBurstSize());
+            assertTrue(RangingRequest.getDefaultRttBurstSize()
+                    >= RangingRequest.getMinRttBurstSize());
+            assertTrue(RangingRequest.getDefaultRttBurstSize()
+                    <= RangingRequest.getMaxRttBurstSize());
+        }
+
+        RangingRequest request = builder.build();
+
+        if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
+            assertEquals(1, request.getRttResponders().size());
+        }
+        range11mcApRequest(request, testAp);
+    }
+
+    /**
+     * Test Wi-Fi RTT ranging using ResponderConfig in the multi-Responder RangingRequest API.
+     * - Scan for visible APs for the test AP (which is validated to support IEEE 802.11mc)
+     * - Perform N (constant) RTT operations
+     * - Validate:
+     *   - Failure ratio < threshold (constant)
+     *   - Result margin < threshold (constant)
+     */
+    public void testRangingToTest11mcApUsingListResponderConfig() throws InterruptedException {
+        if (!shouldTestWifiRtt(getContext())) {
+            return;
+        }
+
+        // Scan for IEEE 802.11mc supporting APs
+        ScanResult testAp = scanForTest11mcCapableAp(NUM_SCANS_SEARCHING_FOR_IEEE80211MC_AP);
+        assertNotNull(
+                "Cannot find any test APs which support RTT / IEEE 802.11mc - please verify that "
+                        + "your test setup includes them!", testAp);
+        ResponderConfig responder = ResponderConfig.fromScanResult(testAp);
+        // Perform RTT operations
+        RangingRequest.Builder builder = new RangingRequest.Builder();
+        List<ResponderConfig> responders = new ArrayList<>();
+        responders.add(responder);
+        builder.addResponders(responders);
+
+        if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
+            builder.setRttBurstSize(RangingRequest.getMaxRttBurstSize());
+            assertTrue(RangingRequest.getDefaultRttBurstSize()
+                    >= RangingRequest.getMinRttBurstSize());
+            assertTrue(RangingRequest.getDefaultRttBurstSize()
+                    <= RangingRequest.getMaxRttBurstSize());
+        }
+
+        RangingRequest request = builder.build();
+
+        if (WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
+            assertEquals(1, request.getRttResponders().size());
+        }
+        range11mcApRequest(request, testAp);
+    }
+
+    /**
+     * Utility method for validating a ranging request.
+     *
+     * @param request the ranging request that is being tested
+     * @param testAp the original test scan result to provide feedback on failure conditions
+     */
+    private void range11mcApRequest(RangingRequest request, ScanResult testAp)
+            throws InterruptedException {
         List<RangingResult> allResults = new ArrayList<>();
         int numFailures = 0;
         int distanceSum = 0;
@@ -217,6 +334,8 @@
         }
     }
 
+
+
     /**
      * Validate that when a request contains more range operations than allowed (by API) that we
      * get an exception.
@@ -451,7 +570,7 @@
     }
 
     /**
-     * Test Wi-Fi One-sided RTT ranging operation:
+     * Test Wi-Fi One-sided RTT ranging operation using ScanResult in request:
      * - Scan for visible APs for the test AP (which do not support IEEE 802.11mc) and are operating
      * - in the 5GHz band.
      * - Perform N (constant) RTT operations
@@ -460,7 +579,7 @@
      *   - Failure ratio < threshold (constant)
      *   - Result margin < threshold (constant)
      */
-    public void testRangingToTestNon11mcAp() throws InterruptedException {
+    public void testRangingToTestNon11mcApUsingScanResult() throws InterruptedException {
         if (!shouldTestWifiRtt(getContext())
                 || !WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
             return;
@@ -478,6 +597,52 @@
         builder.setRttBurstSize(RangingRequest.getMaxRttBurstSize());
         RangingRequest request = builder.build();
 
+        // Perform the rquest
+        rangeNon11mcApRequest(request, testAp, MAX_NON11MC_VARIATION_FROM_AVERAGE_DISTANCE_MM);
+    }
+
+    /**
+     * Test Wi-Fi one-sided RTT ranging operation using ResponderConfig in request:
+     * - Scan for visible APs for the test AP (which do not support IEEE 802.11mc) and are operating
+     * - in the 5GHz band.
+     * - Perform N (constant) RTT operations
+     * - Remove outliers while insuring greater than 50% of the results still remain
+     * - Validate:
+     *   - Failure ratio < threshold (constant)
+     *   - Result margin < threshold (constant)
+     */
+    public void testRangingToTestNon11mcApUsingResponderConfig() throws InterruptedException {
+        if (!shouldTestWifiRtt(getContext())
+                || !WifiBuildCompat.isPlatformOrWifiModuleAtLeastS(getContext())) {
+            return;
+        }
+
+        // Scan for Non-IEEE 802.11mc supporting APs
+        ScanResult testAp = scanForTestNon11mcCapableAp(NUM_SCANS_SEARCHING_FOR_IEEE80211MC_AP);
+        assertNotNull(
+                "Cannot find any test APs which are Non-IEEE 802.11mc - please verify that"
+                        + " your test setup includes them!", testAp);
+
+        ResponderConfig responder = ResponderConfig.fromScanResult(testAp);
+
+        // Perform RTT operations
+        RangingRequest.Builder builder = new RangingRequest.Builder();
+        builder.addResponder(responder);
+        builder.setRttBurstSize(RangingRequest.getMaxRttBurstSize());
+        RangingRequest request = builder.build();
+
+        // Perform the rquest
+        rangeNon11mcApRequest(request, testAp, MAX_NON11MC_VARIATION_FROM_AVERAGE_DISTANCE_MM);
+    }
+
+    /**
+     * Utility method for validating a ranging request to a non-80211mc AP.
+     *
+     * @param request the ranging request that is being tested
+     * @param testAp the original test scan result to provide feedback on failure conditions
+     */
+    private void rangeNon11mcApRequest(RangingRequest request, ScanResult testAp,
+            int variationLimit) throws InterruptedException {
         List<RangingResult> allResults = new ArrayList<>();
         int numFailures = 0;
         int distanceSum = 0;
@@ -571,55 +736,59 @@
                 ResultType.NEUTRAL, ResultUnit.NONE);
         reportLog.submit();
 
-        /** TODO(b/192909380): enable the performance verification after device fix.
-            // Analyze results
-            assertTrue("Wi-Fi RTT failure rate exceeds threshold: FAIL=" + numFailures
-                            + ", ITERATIONS="
-                            + NUM_OF_RTT_ITERATIONS + ", AP RSSI=" + testAp.level
-                            + ", AP SSID=" + testAp.SSID,
-                    numFailures <= NUM_OF_RTT_ITERATIONS * MAX_NON11MC_FAILURE_RATE_PERCENT / 100);
+        // This bug below has been addressed by making the test parameters for Non-80211mc devices
+        // less stringent. Please update the bug if this does not solve the problem.
+        // TODO(b/192909380): enable the performance verification after device fix.
 
-            if (numFailures != NUM_OF_RTT_ITERATIONS) {
-                // Calculate an initial average using all measurements to determine distance outliers
-                double distanceAvg = (double) distanceSum / (NUM_OF_RTT_ITERATIONS - numFailures);
-                // Now figure out the distance outliers and mark them in the distance inclusion map
-                int validDistances = 0;
-                for (int i = 0; i < (NUM_OF_RTT_ITERATIONS - numFailures); i++) {
-                    if (distanceMms[i] - MAX_VARIATION_FROM_AVERAGE_DISTANCE_MM < distanceAvg) {
-                        // Distances that are in range for the distribution are included in the map
-                        distanceInclusionMap[i] = true;
-                        validDistances++;
-                    } else {
-                        // Distances that are out of range for the distribution are excluded in the map
-                        distanceInclusionMap[i] = false;
-                    }
-                }
+        // Analyze results
+        assertTrue("Wi-Fi RTT failure rate exceeds threshold: FAIL=" + numFailures
+                        + ", ITERATIONS="
+                        + NUM_OF_RTT_ITERATIONS + ", AP RSSI=" + testAp.level
+                        + ", AP SSID=" + testAp.SSID,
+                numFailures <= NUM_OF_RTT_ITERATIONS * MAX_NON11MC_FAILURE_RATE_PERCENT / 100);
 
-                assertTrue("After fails+outlier removal greater that 50% distances must remain: " +
-                        NUM_OF_RTT_ITERATIONS / 2, validDistances > NUM_OF_RTT_ITERATIONS / 2);
+        if (numFailures != NUM_OF_RTT_ITERATIONS) {
+            // Calculate an initial average using all measurements to determine distance outliers
+            double distanceAvg = (double) distanceSum / (NUM_OF_RTT_ITERATIONS - numFailures);
+            // Now figure out the distance outliers and mark them in the distance inclusion map
+            int validDistances = 0;
+            for (int i = 0; i < (NUM_OF_RTT_ITERATIONS - numFailures); i++) {
+                if (distanceMms[i] - variationLimit < distanceAvg) {
+                    // Distances that are in range for the distribution are included in the map
+                    distanceInclusionMap[i] = true;
+                    validDistances++;
+                } else {
+                    // Distances that are out of range for the distribution are excluded in the map
+                    distanceInclusionMap[i] = false;
+                }
+            }
 
-                // Remove the distance outliers and find the new average, min and max.
-                distanceSum = 0;
-                distanceMax = Integer.MIN_VALUE;
-                distanceMin = Integer.MAX_VALUE;
-                for (int i = 0; i < (NUM_OF_RTT_ITERATIONS - numFailures); i++) {
-                    if (distanceInclusionMap[i]) {
-                        distanceSum += distanceMms[i];
-                        distanceMin = Math.min(distanceMin, distanceMms[i]);
-                        distanceMax = Math.max(distanceMax, distanceMms[i]);
-                    }
+            assertTrue("After fails+outlier removal greater that 50% distances must remain: "
+                    + NUM_OF_RTT_ITERATIONS / 2, validDistances > NUM_OF_RTT_ITERATIONS / 2);
+
+            // Remove the distance outliers and find the new average, min and max.
+            distanceSum = 0;
+            distanceMax = Integer.MIN_VALUE;
+            distanceMin = Integer.MAX_VALUE;
+            for (int i = 0; i < (NUM_OF_RTT_ITERATIONS - numFailures); i++) {
+                if (distanceInclusionMap[i]) {
+                    distanceSum += distanceMms[i];
+                    distanceMin = Math.min(distanceMin, distanceMms[i]);
+                    distanceMax = Math.max(distanceMax, distanceMms[i]);
                 }
-                distanceAvg = (double) distanceSum / validDistances;
-                assertTrue("Wi-Fi RTT: Variation (max direction) exceeds threshold, Variation ="
-                                + (distanceMax - distanceAvg),
-                        (distanceMax - distanceAvg) <= MAX_VARIATION_FROM_AVERAGE_DISTANCE_MM);
-                assertTrue("Wi-Fi RTT: Variation (min direction) exceeds threshold, Variation ="
-                                + (distanceAvg - distanceMin),
-                        (distanceAvg - distanceMin) <= MAX_VARIATION_FROM_AVERAGE_DISTANCE_MM);
-                for (int i = 0; i < numGoodResults; ++i) {
-                    assertNotSame("Number of attempted measurements is 0", 0, numAttempted[i]);
-                    assertNotSame("Number of successful measurements is 0", 0, numSuccessful[i]);
-                }
-         */
+            }
+            distanceAvg = (double) distanceSum / validDistances;
+            assertTrue("Wi-Fi RTT: Variation (max direction) exceeds threshold, Variation ="
+                            + (distanceMax - distanceAvg),
+                    (distanceMax - distanceAvg) <= variationLimit);
+            assertTrue("Wi-Fi RTT: Variation (min direction) exceeds threshold, Variation ="
+                            + (distanceAvg - distanceMin),
+                    (distanceAvg - distanceMin) <= variationLimit);
+            for (int i = 0; i < numGoodResults; ++i) {
+                assertNotSame("Number of attempted measurements is 0", 0, numAttempted[i]);
+                assertNotSame("Number of successful measurements is 0", 0, numSuccessful[i]);
+            }
+        }
+
     }
 }
diff --git a/tests/uwb/src/android/uwb/cts/RangingSessionTest.java b/tests/uwb/src/android/uwb/cts/RangingSessionTest.java
index a5ed676..a60c36d 100644
--- a/tests/uwb/src/android/uwb/cts/RangingSessionTest.java
+++ b/tests/uwb/src/android/uwb/cts/RangingSessionTest.java
@@ -75,6 +75,29 @@
     }
 
     @Test
+    public void testOnRangingOpened_OnServiceDiscoveredConnectedCalled() {
+        SessionHandle handle = new SessionHandle(123);
+        RangingSession.Callback callback = mock(RangingSession.Callback.class);
+        IUwbAdapter2 adapter = mock(IUwbAdapter2.class);
+        RangingSession session = new RangingSession(EXECUTOR, callback, adapter, handle);
+        verifyOpenState(session, false);
+
+        session.onRangingOpened();
+        verifyOpenState(session, true);
+
+        // Verify that the onOpenSuccess callback was invoked
+        verify(callback, times(1)).onOpened(eq(session));
+        verify(callback, times(0)).onClosed(anyInt(), any());
+
+        session.onServiceDiscovered(PARAMS);
+        verify(callback, times(1)).onServiceDiscovered(eq(PARAMS));
+
+        session.onServiceConnected(PARAMS);
+        verify(callback, times(1)).onServiceConnected(eq(PARAMS));
+    }
+
+
+    @Test
     public void testOnRangingOpened_CannotOpenClosedSession() {
         SessionHandle handle = new SessionHandle(123);
         RangingSession.Callback callback = mock(RangingSession.Callback.class);
diff --git a/tests/uwb/src/android/uwb/cts/UwbManagerTest.java b/tests/uwb/src/android/uwb/cts/UwbManagerTest.java
index 489da9d..a8f350a 100644
--- a/tests/uwb/src/android/uwb/cts/UwbManagerTest.java
+++ b/tests/uwb/src/android/uwb/cts/UwbManagerTest.java
@@ -235,6 +235,120 @@
         }
     }
 
+    @Test
+    public void testAddServiceProfileWithoutUwbPrivileged() {
+        try {
+            mUwbManager.addServiceProfile(new PersistableBundle());
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+    @Test
+    public void testRemoveServiceProfileWithoutUwbPrivileged() {
+        try {
+            mUwbManager.removeServiceProfile(new PersistableBundle());
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+
+    @Test
+    public void testGetAllServiceProfilesWithoutUwbPrivileged() {
+        try {
+            mUwbManager.getAllServiceProfiles();
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+    @Test
+    public void testGetAdfProvisioningAuthoritiesWithoutUwbPrivileged() {
+        try {
+            mUwbManager.getAdfProvisioningAuthorities(new PersistableBundle());
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+    @Test
+    public void testGetAdfCertificateInfoWithoutUwbPrivileged() {
+        try {
+            mUwbManager.getAdfCertificateInfo(new PersistableBundle());
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+    private class AdfProvisionStateCallback extends UwbManager.AdfProvisionStateCallback {
+        private final CountDownLatch mCountDownLatch;
+
+        public boolean onSuccessCalled;
+        public boolean onFailedCalled;
+
+        AdfProvisionStateCallback(@NonNull CountDownLatch countDownLatch) {
+            mCountDownLatch = countDownLatch;
+        }
+
+        @Override
+        public void onProfileAdfsProvisioned(@NonNull PersistableBundle params) {
+            onSuccessCalled = true;
+            mCountDownLatch.countDown();
+        }
+
+        @Override
+        public void onProfileAdfsProvisionFailed(int reason, @NonNull PersistableBundle params) {
+            onFailedCalled = true;
+            mCountDownLatch.countDown();
+        }
+    }
+
+    @Test
+    public void testProvisionProfileAdfByScriptWithoutUwbPrivileged() {
+        CountDownLatch countDownLatch = new CountDownLatch(1);
+        AdfProvisionStateCallback adfProvisionStateCallback =
+                new AdfProvisionStateCallback(countDownLatch);
+        try {
+            mUwbManager.provisionProfileAdfByScript(
+                    new PersistableBundle(),
+                    Executors.newSingleThreadExecutor(),
+                    adfProvisionStateCallback);
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
+    @Test
+    public void testRemoveProfileAdfWithoutUwbPrivileged() {
+        try {
+            mUwbManager.removeProfileAdf(new PersistableBundle());
+            // should fail if the call was successful without UWB_PRIVILEGED permission.
+            fail();
+        } catch (SecurityException e) {
+            /* pass */
+            Log.i(TAG, "Failed with expected security exception: " + e);
+        }
+    }
+
     private class RangingSessionCallback implements RangingSession.Callback {
         private final CountDownLatch mCountDownLatch;
 
diff --git a/tools/cts-device-info/Android.bp b/tools/cts-device-info/Android.bp
index ff85860..2c8b617 100644
--- a/tools/cts-device-info/Android.bp
+++ b/tools/cts-device-info/Android.bp
@@ -32,6 +32,8 @@
         "sts",
         "mts",
         "vts",
+        "catbox",
+        "gcatbox",
     ],
     static_libs: [
         "compatibility-device-info",
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index 89f3c3a..72ff5ce 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -242,8 +242,10 @@
     <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest23#testNoResidualPermissionsOnUninstall" />
  
     <!-- b/198992105 -->
-    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases android.cts.statsd.atom.UidAtomTests#testDangerousPermissionState" />
-    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases android.cts.statsd.atom.UidAtomTests#testDangerousPermissionStateSampled" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases android.cts.statsdatom.permissionstate.DangerousPermissionStateTests#testDangerousPermissionState" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases[instant] android.cts.statsdatom.permissionstate.DangerousPermissionStateTests#testDangerousPermissionState" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases android.cts.statsdatom.permissionstate.DangerousPermissionStateTests#testDangerousPermissionStateSampled" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases[instant] android.cts.statsdatom.permissionstate.DangerousPermissionStateTests#testDangerousPermissionStateSampled" />
 
     <!-- b/202357331 -->
     <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedDeviceOwnerTest#testCreateAdminSupportIntent" />